note 106391 modified in function.call-user-func by danbrown

From: Date: Fri, 04 Nov 2011 13:53:34 +0000
Subject: note 106391 modified in function.call-user-func by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184288@lists.php.net to get a copy of this message
In PHP v5.2, you /can/ use call_user_func(array($this, 'parent::SOME_FUNCTION')). If you don't have custom __autoload() function, you are good to go. If you do have custom __autoload(), you need to make it `parent' aware. Something like: <?php function __autoload($classname) { if ($classname === 'parent') return; else //((load class definition)) } ?> Rationale: PHP 5.2 surprisingly tries to autoload a class named parent'. However, if you don't do anything in __autoload() for the parent' class, it'll work just fine. --was-- In PHP v5.2, you /can/ use call_user_func(array($this, 'parent::SOME_FUNCTION')). If you don't have custom __autoload() function, you are good to go. If you do have custom __autoload(), you need to make it `parent' aware. Something like: <?php function __autoload($classname) { if ($classname === 'parent') return; else ((load class definition)) } ?> Rationale: PHP 5.2 surprisingly tries to autoload a class named parent'. However, if you don't do anything in __autoload() for the parent' class, it'll work just fine. http://php.net/manual/en/function.call-user-func.php

« previous php.notes (#184288) next »