note 74875 added to function.array-merge

From: Date: Tue, 01 May 2007 22:34:13 +0000
Subject: note 74875 added to function.array-merge
Groups: php.notes 
Request: Send a blank email to php-notes+get-126104@lists.php.net to get a copy of this message
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 ---- Server IP: 69.147.83.197 Probable Submitter: 63.201.164.12 ---- Manual Page -- http://www.php.net/manual/en/function.array-merge.php Edit -- https://master.php.net/note/edit/74875 Del: integrated -- https://master.php.net/note/delete/74875/integrated Del: useless -- https://master.php.net/note/delete/74875/useless Del: bad code -- https://master.php.net/note/delete/74875/bad+code Del: spam -- https://master.php.net/note/delete/74875/spam Del: non-english -- https://master.php.net/note/delete/74875/non-english Del: in docs -- https://master.php.net/note/delete/74875/in+docs Del: other reasons-- https://master.php.net/note/delete/74875 Reject -- https://master.php.net/note/reject/74875 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#126104) next »