3v4l.org

run code in 300+ PHP versions simultaneously
<?php $snippet = '<?foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]);'; echo 'Byte length: ' , strlen($snippet) , "\n"; $_GET[A] = [3, 2, 2, 3]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[3, 0, 3], [2, 1, 2]] echo "\n---\n"; unset($b); $_GET[A] = [17]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[17, 0]] echo "\n---\n"; unset($b); $_GET[A] = [1, 1]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[1, 0, 1]] echo "\n---\n"; unset($b); $_GET[A] = [1, 1, 2]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[1, 0, 1], [2, 2]] echo "\n---\n"; unset($b); $_GET[A] = [1, 2, 3, 4]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[1, 0], [2, 1], [3, 2], [4, 3]] echo "\n---\n"; unset($b); $_GET[A] = [1, 1, 1, 1]; foreach($_GET[A]as$k=>$v){$b[$v][0]=$v;$b[$v][]=$k;}print_r([...$b]); // [[1, 0, 1, 2, 3]]
Output for git.master, git.master_jit, rfc.property-hooks
Byte length: 71 Fatal error: Uncaught Error: Undefined constant "A" in /in/UHQWO:5 Stack trace: #0 {main} thrown in /in/UHQWO on line 5
Process exited with code 255.

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