3v4l.org

run code in 500+ PHP versions simultaneously
<?php $prices = array( 'label' => 'Price', 'count' => 5, 'attribute_code' => 'price', 'options' => array( 0 => array( 'label' => '0-100', 'value' => '0_100', 'count' => 2208, ), 1 => array( 'label' => '100-200', 'value' => '100_200', 'count' => 338, ), 2 => array( 'label' => '200-300', 'value' => '200_300', 'count' => 16, ), 3 => array( 'label' => '300-400', 'value' => '300_400', 'count' => 1, ), 4 => array( 'label' => '400-500', 'value' => '400_500', 'count' => 1, ), ) ); $counts = array_sum(array_column($prices['options'], 'count')); $values = array_column($prices['options'], 'value'); array_multisort($values, SORT_ASC, SORT_NATURAL); $lowest = explode('_', $values[array_key_first($values)])[0]; $highest = explode('_', $values[array_key_last($values)])[1]; $prices['options'] = [ 'label' => $lowest . '-' . $highest, 'value' => $lowest . '_' . $highest, 'count' => $counts ]; var_export($prices['options']);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'label' => '0-500', 'value' => '0_500', 'count' => 2564, )

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:
50.5 ms | 1404 KiB | 4 Q