Justtechjobs.com Find a programming school near you






Online Campus Both


php4-beta | 200004

[PHP4BETA] array_walk behaving oddly ... From: Wasim Juned (wasim.juned <email protected>)
Date: 04/11/00

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

-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe <email protected> For additional commands, e-mail: php4beta-help <email protected> To contact the list administrators, e-mail: php4beta-admin <email protected>