PHP5 info from Sterling Hughes
23rd March 2003
Sterling Hughes has posted the slides he will be using for his presentation on PHP 5 next week. They provide a great deal of insight in to the new additions to look forward to in PHP 5, including a few I hadn’t heard about before.
One of the most instantly useful looking is Class Autoloading. By creating a function called __autoload()
you can add logic to automatically include a class the first time it is called. The example code explains this much better:
<?php function __autoload($classname) { include_once("$classname.php"); } $mono = new monkey; $mono->scratch(); ?>
PHP 5 will also feature support for class access control, interfaces and type hinting where a function or method can declare the type it expects for each of its arguments. It’s sounding more and more like Java all the time, but seeing as all of the new support for stricter control are optional I don’t see this as a disadvantage at all. Coders who want serious OOP can have it, while people knocking out a quick script don’t need to worry about them at all.
More recent articles
- My AI/LLM predictions for the next 1, 3 and 6 years, for Oxide and Friends - 10th January 2025
- Weeknotes: Starting 2025 a little slow - 4th January 2025
- I still don't think companies serve you ads based on spying through your microphone - 2nd January 2025