3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [20,22,29,40,67,35,98,200,205,220]; function subArrayValues($array) { static $firstRound = 0; if (count($array) < 2){ echo $array[0]; return; } $prevVal = null; $newArray = []; foreach ($array as $val){ if ($prevVal !== null){ $result = $val - $prevVal; $newArray[] = $result; } $prevVal = $val; } if ($firstRound) echo implode(",", $array) . "\n"; $firstRound++; subArrayValues($newArray); } subArrayValues($arr);
Output for git.master, git.master_jit, rfc.property-hooks
2,7,11,27,-32,63,102,5,15 5,4,16,-59,95,39,-97,10 -1,12,-75,154,-56,-136,107 13,-87,229,-210,-80,243 -100,316,-439,130,323 416,-755,569,193 -1171,1324,-376 2495,-1700 -4195

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