Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

siewlon6093's avatar

protected static function boot()

protected static function boot()
    {
       parent::boot();
    }

What this code do? Can someone explain to me?

and what difference between


( public , private , protected ) ??
0 likes
1 reply
Sti3bas's avatar
Sti3bas
Best Answer
Level 53

What this code do? Can someone explain to me?

It calls the boot method of parent class.

https://www.php.net/manual/en/language.oop5.inheritance.php

and what difference between

Class members declared public can be accessed everywhere.

Members declared protected can be accessed only within the class itself and by inheriting and parent classes.

Members declared as private may only be accessed by the class that defines the member.

https://www.php.net/manual/en/language.oop5.visibility.php

Please or to participate in this conversation.