need array function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

need array function

Post by ddragas »

Hi all

How can I add array to another keeping avlues of keys and values?

example:

$array1 = Array ( [] => 1u [1174723615] => 2u [1174726314] => 3u [1174729371] => 4u [1174729626] => 5u [1174730998] => 6u [1174733506] => 7u [1175529667] => 8u [1175529863] => 9u [1175535233] => 10u [1175536351] => 11u [1175859512] => 12u [1175860194] => 13u [1175860298] => 14u [1175860324] => 15u )

$array2 = Array ( [1174777200] => 2r [1175464800] => 4r [1175810400] => 5r [1175983200] => 8r )

result sholud be:

$array_all = $array1 . $array2;

thank you

regards
ddragas
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

[feyd@home]>php -r "print_r( array('foo'=>123,'bar'=>456) + array('baz'=>123,'sbo'=>789) );"
Array
(
    [foo] => 123
    [bar] => 456
    [baz] => 123
    [sbo] => 789
)
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

LOL

sometimes man can not see tree from wood

:oops:

thank you

regards
Post Reply