3v4l.org

run code in 300+ PHP versions simultaneously
<?php $capacity_array=[2,3]; $allotment_array = [0,0]; $student_object_array = [1,2,3]; $i=0; foreach ($student_object_array as $student_object) { $capacity=$capacity_array[$i]; $allotment=$allotment_array[$i]; if($capacity-$allotment!=0) { $allotment_array[$i] = ++$allotment; echo "\r\nstudent = ".$student_object.' cap = '.$capacity_array[$i].' allot = '.$allotment_array[$i].' i= '.$i; } else{ echo "\r\n else = "; $i++; $capacity=$capacity_array[$i]; $allotment=$allotment_array[$i]; $allotment_array[$i] = ++$allotment; echo "\r\nstudent = ".$student_object.' cap = '.$capacity_array[$i].' allot = '.$allotment_array[$i].' i= '.$i; } }
Output for git.master, git.master_jit, rfc.property-hooks
student = 1 cap = 2 allot = 1 i= 0 student = 2 cap = 2 allot = 2 i= 0 else = student = 3 cap = 3 allot = 1 i= 1

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