1

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

1

3 Answers 3

5
 $filter = array_combine(array("id","description", "portal"), $farray);
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

0
    <?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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.