I have two diff array and I want to print these array based on equal condition.
First array
Array (
[0] => fname
[1] => lname
[2] => email
)
Second array
Array (
[fname] => john
[lname] => notdefined
[email] => [email protected]
[address] => london
)
Now my problem is I want to print values from second array if and only if this array's index match with first array values...
Second array's index == first array's value (I can say this is equality condition for better understanding)
In this case my output should be
Array (
[fname] => john
[lname] => notdefined
[email] => [email protected]
)
It should not display address because in first array is not present...
Here this is just sample code but in reality I have a very big array with some additional info also.
array_flipand then make use ofarray_intersect_keyon the two arrays.