note 44006 deleted from function.array-merge by derek

From: Date: Mon, 03 Jan 2005 22:21:59 +0000
Subject: note 44006 deleted from function.array-merge by derek
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-82659@lists.php.net to get a copy of this message
Note Submitter: seva-php at zend dot com ---- As you know, guys, because of fixing bug #25494, starting from PHP 5.0.0 Beta2 the function doesn't accept scalar values as secondary arguments. It means if you try to run <? array_merge(array('array'),'scalar'); ?> the function throws a warning and returns <? NULL ?> instead of <? array(0=>'array',1=>'scalar');?>. If you want the old behavior of the merge function, use this instead: <? function array_merge_php4($array1,$array2){ $return=array(); foreach(func_get_args() as $arg){ if(!is_array($arg)){ $arg=array($arg); } foreach($arg as $key=>$val){ if(!is_int($key)){ $return[$key]=$val; }else{ $return[]=$val; } } } return $return; } ?>

« previous php.notes (#82659) next »