3v4l.org

run code in 500+ PHP versions simultaneously
<?php $tsp = 9; $fin = [ "1701" => ["total_space" => 0, "count" => 0], "1702" => ["total_space" => 0, "count" => 0], "1703" => ["total_space" => 20, "count" => 20], "1704" => ["total_space" => 28, "count" => 28] ]; $qualifiers = array_filter($fin, fn($row) => $row['count']); $divideBy = count($qualifiers); foreach ($qualifiers as $id => $row) { $tsp -= $toAdd = ceil($tsp / $divideBy); --$divideBy; $fin[$id]['count'] += $toAdd; } var_export($fin);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 1701 => array ( 'total_space' => 0, 'count' => 0, ), 1702 => array ( 'total_space' => 0, 'count' => 0, ), 1703 => array ( 'total_space' => 20, 'count' => 25.0, ), 1704 => array ( 'total_space' => 28, 'count' => 32.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:
43.46 ms | 1301 KiB | 4 Q