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] = ['start'=>$x, 'end'=>$x]; } else { $c[$key]['end'] = $x; }; return $c; }, array());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JkdFu
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   35     1        INIT_FCALL                                               'array_reduce'
          2        INIT_FCALL                                               'array_keys'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        SEND_VAR                                                 $3
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJkdFu%3A35%240'
          7        BIND_LEXICAL                                             ~4, !0
   46     8        SEND_VAL                                                 ~4
          9        SEND_VAL                                                 <array>
         10        DO_ICALL                                         $5      
   35    11        ASSIGN                                                   !1, $5
   46    12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FJkdFu%3A35%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JkdFu
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $c, !1 = $x, !2 = $array, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   37     3        INIT_FCALL                                               'end'
          4        INIT_FCALL                                               'array_keys'
          5        FETCH_DIM_R                                      ~4      !2, !1
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                         $5      
          8        SEND_VAR_NO_REF                               0          $5
          9        DO_ICALL                                         $6      
         10        ASSIGN                                           ~7      !3, $6
         11        ISSET_ISEMPTY_DIM_OBJ                         0  ~8      !0, ~7
         12        BOOL_NOT                                         ~9      ~8
         13      > JMPZ                                                     ~9, ->19
   39    14    >   INIT_ARRAY                                       ~11     !1, 'start'
         15        ADD_ARRAY_ELEMENT                                ~11     !1, 'end'
         16        ASSIGN_DIM                                               !0, !3
         17        OP_DATA                                                  ~11
         18      > JMP                                                      ->22
   43    19    >   FETCH_DIM_W                                      $12     !0, !3
         20        ASSIGN_DIM                                               $12, 'end'
         21        OP_DATA                                                  !1
   45    22    > > RETURN                                                   !0
   46    23*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJkdFu%3A35%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.95 ms | 1400 KiB | 19 Q