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
- Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac - 12th November 2024
- Visualizing local election results with Datasette, Observable and MapLibre GL - 9th November 2024
- Project: VERDAD - tracking misinformation in radio broadcasts using Gemini 1.5 - 7th November 2024