|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-01-15 11:57 UTC] zeev
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 12:00:01 2025 UTC |
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.