3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Car { var $color; function Car($color="green") { $this->color = $color; } function what_color() { return $this->color; } } function print_vars($obj) { foreach (get_object_vars($obj) as $prop => $val) { echo "\t$prop = $val\n"; } } // instantiate one object $herbie = new Car("white"); // show herbie properties echo "\herbie: Properties\n"; print_vars($herbie);

preferences:
29.77 ms | 402 KiB | 5 Q