3v4l.org

run code in 300+ PHP versions simultaneously
<?php $e = new Exception(); // This line cause problem :( // Comment it to see the difference. (string) $e; // This line show the clue (PHP Warning: ...). var_export($e); // This line will be affected. var_export(json_encode([$e])); // But This line still OK. var_export(json_encode($e));
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
\Exception::__set_state(array( 'message' => '', 'string' => 'Exception in /in/F49vv:3 Stack trace: #0 {main}', 'code' => 0, 'file' => '/in/F49vv', 'line' => 3, 'trace' => array ( ), 'previous' => NULL, ))'[{}]''{}'
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 \Exception::__set_state(array( 'message' => '', 'string' => 'Exception in /in/F49vv:3 Stack trace: #0 {main}', 'code' => 0, 'file' => '/in/F49vv', 'line' => 3, 'trace' => array ( ), 'previous' => NULL, ))'[{}]''{}'
Output for 7.0.0 - 7.0.11, 7.0.13 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Exception::__set_state(array( 'message' => '', 'string' => 'Exception in /in/F49vv:3 Stack trace: #0 {main}', 'code' => 0, 'file' => '/in/F49vv', 'line' => 3, 'trace' => array ( ), 'previous' => NULL, ))'[{}]''{}'
Output for 7.0.12
Warning: var_export does not handle circular references in /in/F49vv on line 10 NULLfalse'{}'
Output for 5.6.0 - 5.6.40
Exception::__set_state(array( 'message' => '', 'string' => 'exception \'Exception\' in /in/F49vv:3 Stack trace: #0 {main}', 'code' => 0, 'file' => '/in/F49vv', 'line' => 3, 'trace' => array ( ), 'previous' => NULL, ))'[{}]''{}'

preferences:
254.31 ms | 402 KiB | 291 Q