PHP4 has been discontinued by the developers and support for it is being removed from the web servers. This document contains relevant information on the major changes you may encounter when migrating a PHP4 based web site to PHP5.3.x.
Backward Incompatible Changes
- There are some new reserved keywords. Any keyword listed as "as of PHP 5" or "as of PHP 5.3" can no longer be used as a constant, class name, function name, or method name.
- array_merge() was changed to accept only arrays.
- An object with no properties is no longer considered "empty".
- If there are functions defined in the included file, they can be used in the main file independent if they are before return() or after. If the file is included twice, PHP 5 issues fatal error because functions were already declared, while PHP 4 doesn't complain about it. It is recommended to use include_once() instead of checking if the file was already included and conditionally return inside the included file.
- Passing an array to a function by value no longer resets the array's internal pointer for array accesses made within the function. In other words, in PHP 4 when you passed an array to a function, its internal pointer inside the function would be reset, while in PHP 5, when you pass an array to a function, its array pointer within the function will be wherever it was when the array was passed to the function.
- The New Object Model in PHP 5 results in Objects always being passed by reference.
- The array functions natsort(), natcasesort(), usort(), uasort(), uksort(), array_flip(), and array_unique() no longer accept objects passed as arguments. To apply these functions to an object, cast the object to an array first.
- The behaviour of functions with by-reference parameters called by value has changed. Where previously the function would accept the by-value argument, a fatal error is now emitted. Any previous code passing constants or literals to functions expecting references, will need altering to assign the value to a variable before calling the function.
Additional Detailed information from the PHP Group