note 107217 added to function.array
| From: | JezMax at osu1 dot php dot net | Date: | Tue, 17 Jan 2012 09:33:51 +0000 |
| Subject: | note 107217 added to function.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185667@lists.php.net to get a copy of this message | ||
********array_merge********
<?php
$array_a =
array(1=>"Human",3=>"Dwarf",4=>"Nightelf",7=>"Gnome",11=>"Draenei",22=>"Worgen");
$array_b =
array(2=>"Orc",5=>"Undead",6=>"Tauren",8=>"Troll",9=>"Goblin",10=>"Bloodelf");
$result = array_merge($array_a, $array_b);
print_r($result);
?>
result:
Array
(
[0] => Human
[1] => Dwarf
[2] => Nightelf
[3] => Gnome
[4] => Draenei
[5] => Worgen
[6] => Orc
[7] => Undead
[8] => Tauren
[9] => Troll
[10] => Goblin
[11] => Bloodelf
)
********array********
<?php
$race_a =
array(1=>"Human",3=>"Dwarf",4=>"Nightelf",7=>"Gnome",11=>"Draenei",22=>"Worgen");
print_r($race_a);
$race_h =
array(2=>"Orc",5=>"Undead",6=>"Tauren",8=>"Troll",9=>"Goblin",10=>"Bloodelf");
print_r($race_h);
?>
result:
Array
(
[1] => Human
[3] => Dwarf
[4] => Nightelf
[7] => Gnome
[11] => Draenei
[22] => Worgen
)
Array
(
[2] => Orc
[5] => Undead
[6] => Tauren
[8] => Troll
[9] => Goblin
[10] => Bloodelf
)
********array + array********
<?php
$race_a =
array(1=>"Human",3=>"Dwarf",4=>"Nightelf",7=>"Gnome",11=>"Draenei",22=>"Worgen");
$race_h =
array(2=>"Orc",5=>"Undead",6=>"Tauren",8=>"Troll",9=>"Goblin",10=>"Bloodelf");
print_r($race_a + $race_h);
?>
result:
Array
(
[1] => Human
[3] => Dwarf
[4] => Nightelf
[7] => Gnome
[11] => Draenei
[22] => Worgen
[2] => Orc
[5] => Undead
[6] => Tauren
[8] => Troll
[9] => Goblin
[10] => Bloodelf
)
----
Server IP: 89.187.142.233
Probable Submitter: 81.200.56.135
----
Manual Page -- http://www.php.net/manual/en/function.array.php
Edit -- https://master.php.net/note/edit/107217
Del: integrated -- https://master.php.net/note/delete/107217/integrated
Del: useless -- https://master.php.net/note/delete/107217/useless
Del: bad code -- https://master.php.net/note/delete/107217/bad+code
Del: spam -- https://master.php.net/note/delete/107217/spam
Del: non-english -- https://master.php.net/note/delete/107217/non-english
Del: in docs -- https://master.php.net/note/delete/107217/in+docs
Del: other reasons-- https://master.php.net/note/delete/107217
Reject -- https://master.php.net/note/reject/107217
Search -- https://master.php.net/manage/user-notes.php