3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = range(1, 11); for ($i = 0; sizeof($array); $i++) { $new_array[] = ($i % 2) ? array_pop($array) : array_shift($array); } var_dump($new_array); // but original array is empty var_dump($array);
Output for rfc.property-hooks, git.master, git.master_jit
array(11) { [0]=> int(1) [1]=> int(11) [2]=> int(2) [3]=> int(10) [4]=> int(3) [5]=> int(9) [6]=> int(4) [7]=> int(8) [8]=> int(5) [9]=> int(7) [10]=> int(6) } array(0) { }

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:
87.69 ms | 2551 KiB | 4 Q