note 74875 deleted from function.array-merge by tularis

From: Date: Tue, 01 May 2007 22:50:09 +0000
Subject: note 74875 deleted from function.array-merge by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126105@lists.php.net to get a copy of this message
Note Submitter: ragaskarat at nospamokmaybegmail dot com Reason: bad code ---- I guess I'm trying to do something that absolutely violates the laws of time and space (or, uh, the principles of good programming), because I've found both a MySQL bug (can't concat two group_concat fields, even if you're trying to pull them from a subquery) and the following possible PHP bug. Consider this code (ran on 5.1.1): <?php //1. this works as you would expect. $arr1=array(); $arr2=array("foo"); $bar=array_merge($arr1,$arr2); print_r($bar); //2. this doesn't work, says Argument #2 is not an array $baz=array('arr1'=>$arr1,'arr2'=>$arr2); $bar=array_merge($baz['arr1'],$baz['$arr2']); print_r($bar); //3. now that we give them their own vars, it works again! $arr_i=$baz['arr1']; $arr_ii=$baz['arr2']; $bar=array_merge($arr_i,$arr_ii); print_r($bar); //4. ??? //5. PROFIT!!! ?> Am I missing something here? maybe something that's covered in the documentation? Running PHP 5.1.1

« previous php.notes (#126105) next »