3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(ARRAY_FILTER_USE_KEY); $arr = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4]; var_dump(array_filter($arr, function($v) { return $v < 3; })); var_dump(array_filter($arr, function($k) { return $k == 'b'; }, ARRAY_FILTER_USE_KEY)); var_dump(array_filter($arr, function($v, $k) { return $k == 'b' || $v == 4; }, ARRAY_FILTER_USE_BOTH));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVgNt
function name:  (null)
number of ops:  31
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 2
          2        DO_ICALL                                                 
    5     3        ASSIGN                                                   !0, <array>
    7     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'array_filter'
          6        SEND_VAR                                                 !0
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMVgNt%3A7%240'
    9     8        SEND_VAL                                                 ~3
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                                 
   11    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'array_filter'
         14        SEND_VAR                                                 !0
         15        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMVgNt%3A11%241'
   13    16        SEND_VAL                                                 ~6
         17        SEND_VAL                                                 2
         18        DO_ICALL                                         $7      
         19        SEND_VAR                                                 $7
         20        DO_ICALL                                                 
   15    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'array_filter'
         23        SEND_VAR                                                 !0
         24        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMVgNt%3A15%242'
   17    25        SEND_VAL                                                 ~9
         26        SEND_VAL                                                 1
         27        DO_ICALL                                         $10     
         28        SEND_VAR                                                 $10
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FMVgNt%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVgNt
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        IS_SMALLER                                       ~1      !0, 3
          2      > RETURN                                                   ~1
    9     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FMVgNt%3A7%240

Function %00%7Bclosure%7D%2Fin%2FMVgNt%3A11%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MVgNt
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        IS_EQUAL                                         ~1      !0, 'b'
          2      > RETURN                                                   ~1
   13     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FMVgNt%3A11%241

Function %00%7Bclosure%7D%2Fin%2FMVgNt%3A15%242:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/MVgNt
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        IS_EQUAL                                         ~2      !1, 'b'
          3      > JMPNZ_EX                                         ~2      ~2, ->6
          4    >   IS_EQUAL                                         ~3      !0, 4
          5        BOOL                                             ~2      ~3
          6    > > RETURN                                                   ~2
   17     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FMVgNt%3A15%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.41 ms | 1400 KiB | 17 Q