3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler(function ($errno, $errstr, $errfile, $errline) { $namespace = 'ajf\ErrorExceptions\Dynamic'; $className = implode('', explode(' ', ucwords($errstr))); eval("namespace $namespace { class $className extends \ErrorException {} }"); $fullClassName = $namespace . '\\' . $className; throw new $fullClassName($errstr, 0, $errno, $errfile, $errline); }); try { $repent = sin("123abc"); } catch (ajf\ErrorExceptions\Dynamic\ANonWellFormedNumericValueEncountered $e) { echo "praise be to zend_is_numeric_string_ex: $e"; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: sin(): Argument #1 ($num) must be of type float, string given in /in/17d5X:14 Stack trace: #0 /in/17d5X(14): sin('123abc') #1 {main} thrown in /in/17d5X on line 14
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
praise be to zend_is_numeric_string_ex: ajf\ErrorExceptions\Dynamic\ANonWellFormedNumericValueEncountered: A non well formed numeric value encountered in /in/17d5X:14 Stack trace: #0 [internal function]: {closure}(8, 'A non well form...', '/in/17d5X', 14, Array) #1 /in/17d5X(14): sin('123abc') #2 {main}
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
praise be to zend_is_numeric_string_ex: exception 'ajf\ErrorExceptions\Dynamic\ANonWellFormedNumericValueEncountered' with message 'A non well formed numeric value encountered' in /in/17d5X:14 Stack trace: #0 [internal function]: {closure}(8, 'A non well form...', '/in/17d5X', 14, Array) #1 /in/17d5X(14): sin('123abc') #2 {main}

preferences:
179.26 ms | 402 KiB | 200 Q