Bug in create_function() does not care about referenced variables
| From: | André Langhorst | Date: | Thu, 06 Jul 2000 17:02:45 +0000 |
| Subject: | Bug in create_function() does not care about referenced variables | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23732@lists.php.net to get a copy of this message | ||
I´ll create a function what actual adds a "0" to all values in an array with strlen()=1, the function does work as expected, *instead* that the created function does not mind if that var $array is a reference or not, it is treated as a normal var
say $a is an array with
$a=array(0=>'2000',1=>'1',2=>'2');
$args='$value,$key,&$array'; $body='if (strlen($value)==1) $array[$key]=\'0\'.$value;'; $func=create_function($args,$body); array_walk ($a, $func,$a);*not working* created function
function add_null(&$array) { foreach ($array AS $key=>$value) if (strlen($value)==1) $array[$key]='0'.$value; } regards -- o----------0-¬---------O-·---¬----o---®-----o o O ° . | http://www.kiffen.de | pRoteçt y0ur bRaín |0 O ° ¤ ° · 0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ ° o © ° . · | psychedelic experience | gott@kiffen.de | O ° o ° o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·equivalent *working* function