1) I don't have a php environment handy, so this is completely untested.
2) Assuming the number of element in $ship_methods_allowed is unpredictable, I would try something like this:
$eval_string = "$result = array_intersect(";
for( $i = 0; $i < count( $ship_methods_allowed ); $i++ )
{
$eval_string .= "$ship_methods_allowed[" . $i . "], ";
}
//trim off last ", "
$eval_string = substr($eval_string, 0, -2);
$eval_string .= ");";
eval($eval_string);
//now you should have a $result variable containing the intersection
3) Your var_dump() contradicted your explanation of what $shipping_methods_allowed contains. You should see everything in var_dump() that you expect to be in the array.