3v4l.org

run code in 300+ PHP versions simultaneously
<?php class WarningException extends ErrorException { } set_error_handler(function ($errno , $errstr, $errfile, $errline) { throw new WarningException($errstr, 0, $errno, $errfile, $errline); }, E_WARNING); try { $destination = 'http://badurl/'; $params = array(); $url = $destination . '?' . http_build_query($params); $response = file_get_contents($url); } catch (WarningException $e) { echo "Warning: ", $e->getMessage(); }

preferences:
25.49 ms | 402 KiB | 5 Q