3v4l.org

run code in 500+ PHP versions simultaneously
<?php try { json_encode("\xB1", JSON_THROW_ON_ERROR); } catch (\Throwable $e) { echo "own throw -> ", get_class($e), ", previous: ", $e->getPrevious() ? get_class($e->getPrevious()) : 'null', "\n"; } class Boom implements JsonSerializable { public function jsonSerialize(): mixed { throw new RuntimeException('thrown inside jsonSerialize()'); } } try { json_encode(new Boom(), JSON_THROW_ON_ERROR); } catch (\Throwable $e) { echo "user throw -> ", get_class($e), ", previous: ", $e->getPrevious() ? get_class($e->getPrevious()) : 'null', "\n"; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.100.0090.00818.12

preferences:
44.88 ms | 479 KiB | 5 Q