3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A implements \JsonSerializable { public $prop; public function jsonSerialize() { $obj = new stdClass; if ($this->prop) { $obj->prop = $this->prop; } return $obj; } } class B implements \JsonSerializable { public $a; public function jsonSerialize() { $obj = new stdClass; if ($this->a) { $obj->a = $this->a; } return $obj; } } $a = new A; $b = new B; $b->a = $a; var_dump(json_encode($b));

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
210.29 ms | 2276 KiB | 12 Q