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
- Weeknotes: more datasette-secrets, plus a mystery video project - 7th May 2024
- Weeknotes: Llama 3, AI for Data Journalism, llm-evals and datasette-secrets - 23rd April 2024
- Options for accessing Llama 3 from the terminal using LLM - 22nd April 2024
- AI for Data Journalism: demonstrating what we can do with this stuff right now - 17th April 2024
- Three major LLM releases in 24 hours (plus weeknotes) - 10th April 2024
- Building files-to-prompt entirely using Claude 3 Opus - 8th April 2024
- Running OCR against PDFs and images directly in your browser - 30th March 2024
- llm cmd undo last git commit - a new plugin for LLM - 26th March 2024
- Building and testing C extensions for SQLite with ChatGPT Code Interpreter - 23rd March 2024
- Claude and ChatGPT for ad-hoc sidequests - 22nd March 2024