3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { private $id; private $name; function __construct(int $id, string $name) { $this->id = $id; $this->name = $name; } public function __get($prop) { return $this->$prop; } } $itemList = [ new Item(1, "Item 1"), new Item(2, "Item 2"), new Item(3, "Item 3"), new Item(4, "Item 4") ]; echo implode(',', array_map(fn($obj) => $obj->id, $itemList)); echo "\n---\n"; echo array_reduce( $itemList, fn($result, $obj) => $result . ($result ? ',' : '') . $obj->id );
Output for git.master, git.master_jit, rfc.property-hooks
1,2,3,4 --- 1,2,3,4

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
56.25 ms | 405 KiB | 5 Q