3v4l.org

run code in 300+ PHP versions simultaneously
<?php $user = new stdClass(); $user->id = 1; $user->name = 'John Doe'; class Herman { private $milk; public function setMilk($flag) { $this->milk = $flag; } } $hermit = new Herman(); $hermit->setMilk(true); $user->hermit = $hermit; $foobar = array('foo' => 'bar', 'user' => $user); echo serialize($foobar);

preferences:
34.84 ms | 402 KiB | 5 Q