array_walk behaving oddly ...
| From: | Wasim Juned | Date: | Tue, 11 Apr 2000 19:07:46 +0000 |
| Subject: | array_walk behaving oddly ... | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-13430@lists.php.net to get a copy of this message | ||
query about php3.0.12 vs PHP Version 4.0b4pl1 regards array_walk
which is not working as expected.
Here's the code:
<?
function changeArray($item)
{
$item = "This is $item";
}
$array = array("a","b");
// array_walk functions different in php3/4
// in php3 this changes each element
// but in php4 each element is reinitialised.
array_walk($array,'changeArray');
while($e = current($array))
{
echo "$e<BR>\n";
next($array);
}
?>
--
Wasim Juned