user2388554
user2388554

Reputation:

PHP combine two array

i have one array such as any $_POST without key,after clear html tags i want to merge and combine with other array.for example

PHP

$farray= array($a , $b , $c);

i want to merge with below array:

PHP

$filter=array('id'=>$farray[0], 
              'description'=>$farray[1], 
              'portal'=>$farray[2]);

those array are sample like my code, how to merge this arrays, i dont want to use array cell

Upvotes: 1

Views: 102

Answers (3)

ankit
ankit

Reputation: 86

    <?php
$a1=array("a"=>"Horse","b"=>"Dog");
$a2=array("c"=>"Cow","d"=>"Cat");
print_r(array_merge($a1,$a2));
?> 

output will be Array ( [a] => Horse [b] => Dog [c] => Cow [d]=>Cat)

Upvotes: 0

Rob W
Rob W

Reputation: 9142

Not sure what you're wanting, but there's array_merge

Upvotes: 0

Orangepill
Orangepill

Reputation: 24645

 $filter = array_combine(array("id","description", "portal"), $farray);

Upvotes: 5

Related Questions