3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrays = [ 65 => [ ["p" => 234, "sp" => 234], [ ["p" => 53,"sp" => 5], [ ["p" => 54,"sp" => 1], ["p" => 53,"sp" => 7], ] ], [ "p" => 255, "sp" => 235 ], ] ]; function loop($array, &$coll = [], &$min = null) { foreach ($array as $key => $value) { if (is_array($value)) { loop($value, $coll, $min); } elseif ($key === "p") { if ($min === null) $min = $value; if ($min > $value) { $coll = [$array]; $min = $value; continue; } if($value === $min) $coll[] = $array; } } return $coll; } $arrays[65] = loop($arrays[65]); var_dump($arrays);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qUcJH
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arrays
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   37     1        INIT_FCALL                                               'loop'
          2        FETCH_DIM_R                                      ~3      !0, 65
          3        SEND_VAL                                                 ~3
          4        DO_FCALL                                      0  $4      
          5        ASSIGN_DIM                                               !0, 65
          6        OP_DATA                                                  $4
   38     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function loop:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 30
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 30
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 29
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 29
Branch analysis from position: 19
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/qUcJH
function name:  loop
number of ops:  33
compiled vars:  !0 = $array, !1 = $coll, !2 = $min, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
          2        RECV_INIT                                        !2      null
   21     3      > FE_RESET_R                                       $5      !0, ->30
          4    > > FE_FETCH_R                                       ~6      $5, !3, ->30
          5    >   ASSIGN                                                   !4, ~6
   22     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~8, ->14
   23     8    >   INIT_FCALL_BY_NAME                                       'loop'
          9        SEND_VAR_EX                                              !3
         10        SEND_VAR_EX                                              !1
         11        SEND_VAR_EX                                              !2
         12        DO_FCALL                                      0          
   22    13      > JMP                                                      ->29
   24    14    >   IS_IDENTICAL                                             !4, 'p'
         15      > JMPZ                                                     ~10, ->29
   25    16    >   TYPE_CHECK                                    2          !2
         17      > JMPZ                                                     ~11, ->19
         18    >   ASSIGN                                                   !2, !3
   26    19    >   IS_SMALLER                                               !3, !2
         20      > JMPZ                                                     ~13, ->25
   27    21    >   INIT_ARRAY                                       ~14     !0
         22        ASSIGN                                                   !1, ~14
   28    23        ASSIGN                                                   !2, !3
   29    24      > JMP                                                      ->4
   31    25    >   IS_IDENTICAL                                             !3, !2
         26      > JMPZ                                                     ~17, ->29
         27    >   ASSIGN_DIM                                               !1
         28        OP_DATA                                                  !0
   21    29    > > JMP                                                      ->4
         30    >   FE_FREE                                                  $5
   34    31      > RETURN                                                   !1
   35    32*     > RETURN                                                   null

End of function loop

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.49 ms | 1017 KiB | 15 Q