I think you would be better off with
exec( "ping $ip -c $interval" , $retarray , $return_code );
or
$ret_string = shell_exec( "ping $ip -c $interval" );
You can then check the returned output for 'Timed out' or the IP address.
Either way would work.
HalfaBee