-
9 Magic Methods in PHP
11 December 2012
Read moreThis post forms part of a series of articles about using PHP to do objected oriented programming, or OOP. They were originally published elsewhere but are no longer available at that location, so I'm reposting them here. Previously in the series was an introduction to OOP in PHP, in two parts
The title is a bit of a red herring as PHP has more than 9 magic methods, but these will get you off to a good start using PHP's magic methods. It might be magic, but no wands are required!
-
PHP's Magic __invoke() Method and the Callable Typehint
10 July 2012
Read morePHP has a variety of magic methods; methods named with two underscores at the start, which get called automatically when a particular event happens. In PHP 5.3, a new magic method was added: __invoke().