I have two arrays of the same length containing some values.
$a = array("a","b","x","x");
$b = array("f","g","g","h");
Now I want to get the values from $b
at the index postions from where $a
is x
.
$ids = array_keys($a, 'x');
$res = ???($b,$ids);
print_r($res);
So what function will give me an Array containing g
and h
. Or is there even a more elegent (e.g. not using array_keys()
) to do this?