OOP ¡PHP ¡
PHP ¡is ¡an ¡object-‑oriented ¡language ¡
- See: ¡h8p://us.php.net/manual/en/language.oop5.php ¡ ¡ ¡
– Has ¡classes ¡+ ¡objects ¡ – Has ¡inheritance ¡and ¡method ¡overriding ¡
- However, ¡the ¡dynamic ¡typing ¡of ¡PHP ¡variables ¡does ¡
not ¡give ¡it ¡quite ¡the ¡same ¡type ¡of ¡polymorphism ¡as ¡ Java ¡
– The ¡reference ¡type ¡always ¡matches ¡the ¡object ¡type ¡
– Object ¡syntax ¡is ¡more ¡like ¡C++ ¡than ¡Java ¡
- Uses ¡the ¡scope ¡resoluKon ¡operator ¡for ¡parent ¡class ¡
access ¡-‑ ¡:: ¡
- Uses ¡the ¡“arrow” ¡operator ¡for ¡field ¡/ ¡method ¡access ¡
1 ¡
Lecture ¡6 ¡