if you want to return the index of $operation for a given item in $value, you will have to loop through all the elements of $operation. Given your example, though, I cannot think of any programmatic way to correlate a given item in $operation with a given $value. I know because I'm an anglo-saxon human being that 'Bill' is a nickname for 'William' and that the two correspond, but a computer is not going to know this...unless i define another array which gives me the nickname for a given full name....something like
$nicknames['William'] = 'Bill';
if this extra array existed, then i might be able to write a function like this:
function get_operation_index($val_name) {
global $operation;
foreach($operation as $key=>$name) {
if ($nicknames[$name] == $val_name) {
return $key
}
}
return false;
}
and call it like this:
$index = get_operation_index($value[0]);
// this should say 'William'
echo $operation[$index];
On the other hand, your example suggests that $operation and $value refer to the same items, only $value contains nicknames and $operation contains full names. If you are certain that this relationship is always true, then you know that the nickname if $operation[1] is $value[1].