I have two arrays :
$array1 = array(1=>1,10=>1,12=>0,13=>13);
$array2 = array(1=>"Hello",10=>"Test",12=>"check",13=>"error");
Here $array1 have keys and values.Now i want to take first value from $array1(as 1) and want to check if this is repeated in this array .
Here 1 is repeated two times so i want to take the twp keys 1,10 and display the corresponding values of this keys from $array2.If the value in $array1 not repeated just display the value of this key from $array2.
That is i want to get the output as :
Hello Test
check
error
That means ,
In $array1 1,10 keys have same value so value of 1 and 10 from $array2 is merged.then displayed.
Like 12 ,have 0 this is not repeated so simply take value of 12 from $array2.
Like 13.
How can i do this?
No comments:
Post a Comment