Archive for the ‘OOP’ Category

PHP SPL autoload vs. __autoload

Posted: 2010/11/03 in OOP, PHP

A very nice feature in PHP 5 is ‘autoloading’ which allows for (1) class files (usually .php or .php.inc or .inc) to be automatically loaded when needed and similarly (2) only those files that need to be included are included (a little bit of memory savings).

In the past, I have used the __autoload() function which tells PHP to run a function I have created every time a class is instantiated with new (or called statically).

Recently, however, I came across an SPL version of autoloading. (more…)

Advertisements