Re: array_walk provides odd results

From: Date: Tue, 14 Nov 2000 02:46:02 +0000
Subject: Re: array_walk provides odd results
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25100@lists.php.net to get a copy of this message
Brian Clark wrote: > Waldo L. Jaquith wrote: >> I'm trying to use array_walk to run a function on each element of an array. >> But it just isn't working. Below is a simple little script -- I define a >> function that runs AddSlashes, then I make a simple array, then array_walk >> it, and finally echo the contents of the (theoretically) now-slash-escaped >> array. >> >> I've tried this on v4.0.0 and v4.03pl1 with the same results in each: no >> slash-escaping of quotes. Having tried running other functions on the >> content (trim, reversing the string, etc.), I believe that AddSlashes is not >> a part of the problem. > As far as I know, no one answered this, so sorry if it's already been covered. > You can always try reinventing the wheel, although I haven't tried this > under 4.x to make sure it produces the same output: [wheel reinventing omitted] > array_walk() and the above function produce the same output under PHP 3.0.18. Fortunately, this is an unusually simple wheel to reinvent. :) I imagine that anybody that uses your code will be able to achieve the same effect as the array_walk() function without any slowdown. And, unless I find out something about what's up with array_walk(), I believe I'll make use of your fine-looking wheel, which appears much closer to true than PHP's. Best, Waldo Waldo L. Jaquith < waldo@munkandphyber.com > < 804/979.2980 > // Munk & Phyber, Inc. // 110B Second Street NE // Charlottesville, VA 22902

« previous php.general (#25100) next »