diff --git a/guide/english/php/object-oriented-programming/index.md b/guide/english/php/object-oriented-programming/index.md index e9463d34576..b2d047a6ad4 100644 --- a/guide/english/php/object-oriented-programming/index.md +++ b/guide/english/php/object-oriented-programming/index.md @@ -371,3 +371,25 @@ echo json_encode($jack->getFavDrinks()); ``` This way of implementing and using class methods to retrieve and update class properties is called encapsulation in Object Oriented Programming. We can also set visibility for class methods just like how we did it for class properties. + +### MAGIC METHODS + +There are some special methods that Php uses for its own purpose. + +Suppose you want to threat an object as a string. You can do that by overriding `__toString()` method into related class: + +``` +