Re: [PHP4BETA] Problem with array_merge

From: Date: Thu, 23 Mar 2000 15:09:24 +0000
Subject: Re: [PHP4BETA] Problem with array_merge
References: 1 2  Groups: php.version4 
Request: Send a blank email to php-version4+get-12530@lists.php.net to get a copy of this message
Hi Andrei, Andrei Zmievski wrote: > > On Thu, 23 Mar 2000, Martin Samesch wrote: > > ---snip--- > > $array1 = array("column1" => $item1, "column2" => $item2); > > $array2 = array("column3" => $item3); > > $array3 = array_merge($array1, $array2); > > [....] > > Now, $into_columns should look like this (?): (column1,column2,column3), > > but I always get (column1,column2column3). Same with $values. > > > > Before I used array_merge I tried with array_push and array_unshift, but > > only got empty arrays. > > > > Isn't it possible to use those functions with associative arrays or am I > > doing something wrong? > > I'm not aware of any problems with array_merge(). Put var_dump($array3) > after the array_merge() and you'll see that it functions properly. Also, > in your example I'm not sure where $values_arr is coming from. Thanks a lot for your valuable hint. With var_dump I immediately found the mistake. It was a "column"=>NULL which caused the error. Now everthing is working fine. Obviously var_dump() isn't described in the manual (why?): 15:17:35 (martin@tutnix):~ $ grep -r var_dump /usr/local/doc/php4/manual /usr/local/doc/php4/manual/function.getimagesize.html: var_dump($iptc); /usr/local/doc/php4/manual/function.ocibindbyname.html: var_dump($arr); /usr/local/doc/php4/manual/function.ocinewcursor.html: var_dump($data); Sorry, I left some lines of code out. $array3 was passed to a function, hence the name $values_array. Martin

« previous php.version4 (#12530) next »