3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 41 => Array ( 'name' => 'London ', 'company' => 'nhyt6t', 'top25_1' => 8.75912088 ), 42 => Array ( 'name' => 'Manchester', 'company' => 'gtr4rf', 'top25_1' => 6.56758398 ), 43 => Array ( 'name' => 'Leeds', 'company' => 'de3wsd6', 'top25_1' => 7.58675398 ), 44 => Array ( 'name' => '--- ', 'company' => 'nhyt6t', 'top25_2' => 1 ), 45 => Array ( 'name' => '---', 'company' => 'gtr4rf', 'top25_2' => 1 ), 46 => Array ( 'name' => '??', 'company' => 'de3wsd6', 'top25_3' => 7.58675398 ) ); $result = array_reduce(array_keys($array), function($c, $x) use ($array) { if(!isset($c[$key = end(array_keys($array[$x]))])) { $c[$key] = array('start'=>$x, 'end'=>$x); } else { $c[$key]['end'] = $x; }; return $c; }, array());
Output for git.master, git.master_jit, rfc.property-hooks
Notice: Only variables should be passed by reference in /in/KF9su on line 37 Notice: Only variables should be passed by reference in /in/KF9su on line 37 Notice: Only variables should be passed by reference in /in/KF9su on line 37 Notice: Only variables should be passed by reference in /in/KF9su on line 37 Notice: Only variables should be passed by reference in /in/KF9su on line 37 Notice: Only variables should be passed by reference in /in/KF9su on line 37

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:
38.9 ms | 402 KiB | 8 Q