3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo { interface FooInterface { public function foo(string $str); } } namespace Bar { use Foo\FooInterface; class BarClass implements FooInterface { public function foo(string $str) { } } if (version_compare(PHP_VERSION, '7.0', '<')) { function type_hint($code, $error) { if (strpos($error, 'string, string') !== false) { return true; } if (strpos($error, 'int, integer') !== false) { return true; } if (strpos($error, 'bool, boolean') !== false) { return true; } if (strpos($error, 'float, double') !== false) { return true; } return false; } set_error_handler('Bar\type_hint', E_RECOVERABLE_ERROR); function parse_error($code, $error) { print ' => ' . $code . ':' . $error; exit; } set_error_handler('Bar\parse_error', E_STRICT); } }

preferences:
77.15 ms | 402 KiB | 5 Q