Patrick Allaert's Blog: Coding standards: converts PHP4 style co...

Courtesy PHPDeveloper.org  Fri, 10/30/2009 - 06:51

Patrick Allaert has put together a shell command that can take your PHP4 code and replace its current constructors with PHP5-formatted ones.

It assumes your classes are always declared with the class keyword starting at the beginning of the line and that your files have the .php extension.

It uses a regular expression in a perl command to search through the current directory and look for the ".php" files to replace the "function ClassName" sort of thing with a "function __construct".


 

More related items

PHPMaster.com: MongoDB Revisited
In this new post to PHPMaster.com today Ahmed Shreef continues on from his previous introduction to MongoDB and gets into more detail on things like cursors, query operators, queries on...

PHP for All the Things - PHP Advent
PHP was originally designed for web sites and is still widely thought of only as a programming language for the Web. But with the approaches below and a variety of useful console libraries,...

Twig extension - Derick Rethans
Twig extension London, UK Monday, November 21st 2011, 09:20 GMT A while ago, Fabien asked me to have a look at porting one of Twig's slowest methods, TwigTemplate::getAttribute(), into...


 

Post new comment

The content of this field is kept private and will not be shown publicly.
computer-internet.marc8.com