3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = 29.5; $precision = 0.01; $count = 6; $minElement = floor($input / $precision / $count); $countAdditionalElements = ($input / $precision) - $minElement * $count; $result = []; for ($i = 0; $i < $count; $i++) { if ($i >= $countAdditionalElements) { $result[$i] = $minElement * $precision; } else { $result[$i] = ($minElement + 1) * $precision; } } var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(6) { [0]=> float(4.92) [1]=> float(4.92) [2]=> float(4.92) [3]=> float(4.92) [4]=> float(4.91) [5]=> float(4.91) }

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