3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array( 'type' => 'checkbox', 'id' => 'f0', 'is_active' => 1 ), array( 'type' => 'checkbox', 'id' => 'f1', 'is_active' => 0 ), array( 'type' => 'radio', 'id' => 'f2', 'is_active' => 0 ), array( 'type' => 'checkbox', 'id' => 'f3', 'is_active' => 1 ), array( 'type' => 'text', 'id' => 'f4', 'is_active' => 1 ) ); $filtered = array_reduce($array, function($a,$b){ if($b['type'] == 'checkbox' && $b['is_active'] == 1){ $a[] = $b; return $a; }else{ return $a; }},[]); print_r($filtered);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CnX47
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array, !1 = $filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   29     1        INIT_FCALL                                               'array_reduce'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
   35     4        SEND_VAL                                                 ~3
          5        SEND_VAL                                                 <array>
   29     6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   36     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/CnX47
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   30     2        FETCH_DIM_R                                      ~2      !1, 'type'
          3        IS_EQUAL                                         ~3      ~2, 'checkbox'
          4      > JMPZ_EX                                          ~3      ~3, ->8
          5    >   FETCH_DIM_R                                      ~4      !1, 'is_active'
          6        IS_EQUAL                                         ~5      ~4, 1
          7        BOOL                                             ~3      ~5
          8    > > JMPZ                                                     ~3, ->13
   31     9    >   ASSIGN_DIM                                               !0
         10        OP_DATA                                                  !1
   32    11      > RETURN                                                   !0
   30    12*       JMP                                                      ->14
   34    13    > > RETURN                                                   !0
   35    14*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.3 ms | 1012 KiB | 15 Q