3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $_array; protected $_first; public function __construct(array $array) { foreach ($array as $i) is_int($i); $this->_first = current($array); $this->_array = $array; } public function getArray() { return $this->_array; } public function getFirst() { return current($this->_array); } public function getFirstName() { return key($this->_array); } } $array = [1, 2, 3]; $a = new A($array); foreach ($a->getArray() as $i) echo $i . PHP_EOL; echo $a->getFirst(); echo "\n--------\n"; $array = $a->getArray(); foreach ($array as $i) echo $i . PHP_EOL; echo $a->getFirst();
Output for git.master, git.master_jit, rfc.property-hooks
1 2 3 1 -------- 1 2 3 1

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:
61.67 ms | 401 KiB | 8 Q