3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyArray { private $arrayRef; function __construct(&$array){ $this->arrayRef =& $array; } function addElement($newElement){ $this->arrayRef[] = $newElement; } function print(){ print_r($this->arrayRef); } } $array = ['first', 'second']; $arrayObject = new MyArray($array); $arrayObject->addElement('treci'); print_r($array); // prints array containing 2 elements echo '<br/>'; $arrayObject->print(); // prints array containing 3 elements
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => first [1] => second [2] => treci ) <br/>Array ( [0] => first [1] => second [2] => treci )

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:
115.51 ms | 405 KiB | 5 Q