3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $id; public function __construct(){ static $counter = 0; $this->id = $counter; ++$counter; } } $collection = [new Foo(), new Foo(), new Foo(), new Foo()]; print_r(array_column($collection, 'id'));

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
166.6 ms | 3314 KiB | 10 Q