foreach only works with a single array. To step through multiple arrays, it's better to use the each() function in a while loop:
while(($code = each($codes)) && ($name = each($names))) {
echo '<option value="' . $code['value'] . '">' . $name['value'] . '</option>';
}
each() returns information about the current key and value of the array and increments the internal pointer by one, or returns false if it has reached the end of the array. This code would not be dependent upon the two arrays having identical keys or having the same sort of elements. The loop terminates when one of the two arrays is finished.