3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar; private $baz; public function __construct($bar, $baz) { $this->bar = $bar; $this->baz = $baz; } } $foo = new Foo('hello','word'); $string = json_encode($foo); echo $string;

preferences:
46.53 ms | 402 KiB | 5 Q