Are you facing an error that says:
Parse error: parse error, expecting `T_OLD_FUNCTION’ or `T_FUNCTION’ or `T_VAR’ or `’}” in ….
Well chances are that you are trying to run a Class written for PHP5 in PHP 4. This is what you have to do in order to make a class written in PHP5 Class to work in PHP4 or for that matter in PHP 3.
- Remove all PUBLIC, PRIVATE and PROTECTED keywords.
- Prefix “var” keyword before each variable declared in the class.
- Rename the constructor of the class (of any) from __construct() to NameOfTheClass()
- Look for PHP 5 specific functions like simplexml_load_string() and replace/recode them with PHP4 equivalent code.
For Example:
In PHP 5
class dummy() {
private $variable;
public function __constructor(){
//Contructor function....
}
public function getValue() {
..........
In PHP4
class dummy() {
var $variable;
function dummy(){
//Contructor function....
}
function getValue() {
..........

If you liked my post, feel free to subscribe to my rss feeds





































One Trackback
[...] della classe. Su questo blog c’è un riassunto delle compatibilità per le classi da PHP5 a PHP4: http://rochakchauhan.com/blog/2007/09/12/how-to-make-a-php-5-class-work-in-php-4/ Penso che il motivo sia [...]