3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['type' => 'Recurring', 'id' => 1], ['type' => 'Single', 'id' => 2], ['type' => 'Other', 'id' => 3], ['type' => 'Recurring', 'id' => 4], ['type' => 'Single', 'id' => 5], ]; $result = []; foreach ($array as $row) { if (in_array($row['type'], ['Recurring', 'Single'])) { $result[strtolower($row['type'])][] = $row; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/QR3ie
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array, !1 = $result, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   12     2      > FE_RESET_R                                       $5      !0, ->15
          3    > > FE_FETCH_R                                               $5, !2, ->15
   13     4    >   FETCH_DIM_R                                      ~6      !2, 'type'
          5        IN_ARRAY                                                 ~6, <array>
          6      > JMPZ                                                     ~7, ->14
   14     7    >   INIT_FCALL                                               'strtolower'
          8        FETCH_DIM_R                                      ~8      !2, 'type'
          9        SEND_VAL                                                 ~8
         10        DO_ICALL                                         $9      
         11        FETCH_DIM_W                                      $10     !1, $9
         12        ASSIGN_DIM                                               $10
         13        OP_DATA                                                  !2
   12    14    > > JMP                                                      ->3
         15    >   FE_FREE                                                  $5
   17    16        INIT_FCALL                                               'var_export'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.28 ms | 998 KiB | 15 Q