note 41811 added to language.operators.array

From: Date: Thu, 22 Apr 2004 17:40:32 +0000
Subject: note 41811 added to language.operators.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-68541@lists.php.net to get a copy of this message
Note that + will not renumber numeric array keys. If you have two numeric arrays, and their indices overlap, + will use the first array's values for each numeric key, adding the 2nd array's values only where the first doesn't already have a value for that index. Example: $a = array('red', 'orange'); $b = array('yellow', 'green', 'blue'); $both = $a + $b; var_dump($both); Produces the output: array(3) { [0]=> string(3) "red" [1]=> string(6) "orange" [2]=> string(4) "blue" } To get a 5-element array, use array_merge. Dan ---- Manual Page -- http://www.php.net/manual/en/language.operators.array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41811 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41811&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41811&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#68541) next »