gklp blog

ve dönüş yaklaşır….

Adding two array – different array

without comments

Hi, we have a array , and other array. We want to combine it, for example array(1,2,3,4) – the other array array(a,b,c,d). we want that 1 show -> a , 2 ->b etc…

Look! we can combine it !


< ?php

  $array1=array(1,4,5,6);
  $array2=array(A,K,M,P);
  $array3= array_combine($array1,$array2); 

//array3 will be
 $array3=
   array(
     [1]=>A,
     [4]=>K,
     [5]=>M,
     [6]=>P,
   )

?>

Written by Gökalp Kuşçu

Eylül 26th, 2009 at 11:03 pm

bir yorum yaz: