3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [ 101 => 5, 109 => 100, 220 => 50, 231 => 45, 245 => 90 ]; $b = [ 'PRO' => 12, 'LOG' => 15, 'DEV' => 100 ]; $difference = 0; foreach ($a as &$minuend) { while ($minuend && ($b || $difference < 0)) { $suprahend = $difference < 0 ? -$difference : array_shift($b); $difference = $minuend - $suprahend; $minuend = max(0, $difference); } } var_export($a);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 101 => 0, 109 => 0, 220 => 28, 231 => 45, 245 => 90, )

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