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.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
\Exception::__set_state(array( 'message' => '', 'string' => '', 'code' => 0, 'file' => '/in/Lgvq6', 'line' => 3, 'trace' => array ( ), 'previous' => NULL, ))'[{}]''{}'
Output for 5.6.0 - 5.6.27, 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, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33
Exception::__set_state(array( 'message' => '', 'string' => '', 'code' => 0, 'file' => '/in/Lgvq6', 'line' => 3, 'trace' => array ( ), 'previous' => NULL, ))'[{}]''{}'

preferences:
378.32 ms | 409 KiB | 5 Q