NYCPHP Meetup

NYPHP.org

[nycphp-talk] Function works, array_walk fails

Hans Zaunere hans at nyphp.org
Wed Nov 5 10:39:52 EST 2003



soazine at pop.erols.com wrote:

> I posted a problem on www.phpfreaks.com about the means of determining if a
> function you write will work by using array_walk to test a collection of
> parameters.  Though I can verify that my function works by using scalar
> parameters, using array_walk completely fails to work (though it does
> produce a "true" output upon execution).
> 
> The thread of my discussion, along with code and further explanation of my
> methodology, can be found here:
> http://www.phpfreaks.com/forums/topic10189.php
> 
> I'm not in any major hurry, however, I would like to be able to
> successfully use array_walk in the future and, so far, I cannot; every time
> I use it the callback function never returns my changed value, even while
> using a reference as a value parameter in the callback function (again, see
> message thread).

You can't use the return value of the callback function, and it's not passed back through array_walk().  array_walk() only returns a boolean, and if you take particular note of the last paragraph at http://php.net/array_walk

H





More information about the talk mailing list