3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('MAX_LOOPS',5); function withRefValue($elements, $transform) { for ($i=0; $i<$elements; $i++) { $a[] = "v.$i"; } $counter=0; foreach ($a as $k=>$v) { eval($transform); $counter++; if ($counter>MAX_LOOPS) { break; } } echo "--> State of array after loop:\n"; var_dump($a); } echo "\nPopping elements off end of an unreferenced array, using &\$value."; $transform = 'array_pop($a);'; withRefValue(1, $transform); withRefValue(2, $transform); withRefValue(3, $transform); withRefValue(4, $transform); withRefValue(5, $transform); withRefValue(6, $transform); withRefValue(7, $transform); withRefValue(8, $transform); withRefValue(9, $transform); withRefValue(10, $transform); withRefValue(11, $transform); withRefValue(12, $transform);
Output for git.master, git.master_jit, rfc.property-hooks
Popping elements off end of an unreferenced array, using &$value.--> State of array after loop: array(0) { } --> State of array after loop: array(0) { } --> State of array after loop: array(0) { } --> State of array after loop: array(0) { } --> State of array after loop: array(0) { } --> State of array after loop: array(0) { } --> State of array after loop: array(1) { [0]=> string(3) "v.0" } --> State of array after loop: array(2) { [0]=> string(3) "v.0" [1]=> string(3) "v.1" } --> State of array after loop: array(3) { [0]=> string(3) "v.0" [1]=> string(3) "v.1" [2]=> string(3) "v.2" } --> State of array after loop: array(4) { [0]=> string(3) "v.0" [1]=> string(3) "v.1" [2]=> string(3) "v.2" [3]=> string(3) "v.3" } --> State of array after loop: array(5) { [0]=> string(3) "v.0" [1]=> string(3) "v.1" [2]=> string(3) "v.2" [3]=> string(3) "v.3" [4]=> string(3) "v.4" } --> State of array after loop: array(6) { [0]=> string(3) "v.0" [1]=> string(3) "v.1" [2]=> string(3) "v.2" [3]=> string(3) "v.3" [4]=> string(3) "v.4" [5]=> string(3) "v.5" }

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:
53.11 ms | 403 KiB | 8 Q