3v4l.org

run code in 300+ PHP versions simultaneously
<?php function roundRating($rating, $ratings) { if (in_array($rating, $ratings)) { return $rating; } foreach($ratings as $key => $value) { if ($value > $rating) { return $ratings[($key - 1)]; } } return FALSE; } $ratings = [0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]; $rating = 4.3; if ($rate = roundRating($rating, $ratings)) echo sprintf('%.01f', $rate);
Output for git.master, git.master_jit, rfc.property-hooks
4.0

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