Bug #1074: array_walk and register_shutdown_function
| From: | roy dot media at vantage dot nl | Date: | Fri, 15 Jan 1999 14:49:41 +0000 |
| Subject: | Bug #1074: array_walk and register_shutdown_function | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3570@lists.php.net to get a copy of this message | ||
From: roy.media@vantage.nl
Operating system: Linux
PHP version: 3.0.6
PHP Bug Type: Misbehaving function
Bug description: array_walk and register_shutdown_function
The following code does not work:
=====
class myClass {
function myClass() {
}
function testMe() {
array_walk(array(1,2,3,4), 'showMe');
}
function showMe($myElement) {
print $myElement;
}
}
$myClass= new myClass();
$myClass->testMe();
=====
However if you place the 'showMe' function outside of the class it will work, but then you
get problems when you want to use local vars of the class in the 'showMe' function
(offcourse you can declare globals and such, but thats ugly). I am wondering if the same thing
applies to the 'register_shutdown_function' function (or any other function that has a
'string func' as an argument). Is there maybe a way to let PHP know you want to use a
function in the class you are calling 'array_walk' from? If not i hope somebody fixes it,
also it would be nice to have both key and element passed as arguments to 'string func', i
know it has been said before.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net