3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Artist implements ArrayAccess { public $artist_name; function __construct($name) { $this->artist_name = $name; } function offsetGet($name) { return $this->$name; } function offsetExists($name) { return isset($this->$name); } function offsetSet($name, $value) { $this->$name = $value; } function offsetUnset($name) { unset($this->$name); } } $artists = array( new Artist('Dali'), new Artist('Picasso'), new Artist('Titian'), ); echo implode(', ', array_column($artists, 'artist_name')), "\n"; /*****/

preferences:
39.98 ms | 402 KiB | 5 Q