3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public int $a; protected int $b; private int $c; public function __construct() { $this->a = 2; $this->b = 3; $this->c = 4; } } $foo = new Foo(); $arr = (array) $foo; $o = (object) $arr; // should emit a warning as protected properties are renamed print_r($foo); print_r($arr); print_r($o); $o->b = 10; // because this creates new property! print_r($o);

preferences:
38.77 ms | 404 KiB | 5 Q