note 76596 added to function.array-merge

From: Date: Sat, 21 Jul 2007 23:52:54 +0000
Subject: note 76596 added to function.array-merge
Groups: php.notes 
Request: Send a blank email to php-notes+get-128807@lists.php.net to get a copy of this message
Similar to Jo I had a problem merging arrays (thanks for that Jo you kicked me out of my debugging slumber) - array_merge does NOT act like array_push, as I had anticipated <?php $array = array('1', 'hello'); array_push($array, 'world'); var_dump($array); // gives '1', 'hello', 'world' $array = array('1', 'hello'); array_merge($array, array('world')); // gives '1', 'hello' $array = array('1', 'hello'); $array = array_merge($array, array('world')); // gives '1', 'hello', 'world' ?> hope this helps someone ---- Server IP: 69.147.83.197 Probable Submitter: 91.142.233.110 ---- Manual Page -- http://www.php.net/manual/en/function.array-merge.php Edit -- https://master.php.net/note/edit/76596 Del: integrated -- https://master.php.net/note/delete/76596/integrated Del: useless -- https://master.php.net/note/delete/76596/useless Del: bad code -- https://master.php.net/note/delete/76596/bad+code Del: spam -- https://master.php.net/note/delete/76596/spam Del: non-english -- https://master.php.net/note/delete/76596/non-english Del: in docs -- https://master.php.net/note/delete/76596/in+docs Del: other reasons-- https://master.php.net/note/delete/76596 Reject -- https://master.php.net/note/reject/76596 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128807) next »