I do this to, but as so to prevent some mess:
PHP Code:
$loo_show = array(); // this array holds your custom show info
$show = array_merge($show, $loo_show); // merges custom show info into regular show array
Also everyone should be aware that array_merge changed in php version 5:
Quote:
From php.net comments
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:
PHP Code:
<?
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;
}
?>
|
Good stuff Michael.