3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(ARRAY_FILTER_USE_KEY); var_dump(ARRAY_FILTER_USE_BOTH); $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/STFXS
function name:  (null)
number of ops:  34
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                                                 
    4     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAL                                                 1
          5        DO_ICALL                                                 
    6     6        ASSIGN                                                   !0, <array>
    8     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'array_filter'
          9        SEND_VAR                                                 !0
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FSTFXS%3A8%240'
   10    11        SEND_VAL                                                 ~4
         12        DO_ICALL                                         $5      
         13        SEND_VAR                                                 $5
         14        DO_ICALL                                                 
   12    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'array_filter'
         17        SEND_VAR                                                 !0
         18        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FSTFXS%3A12%241'
   14    19        SEND_VAL                                                 ~7
         20        SEND_VAL                                                 2
         21        DO_ICALL                                         $8      
         22        SEND_VAR                                                 $8
         23        DO_ICALL                                                 
   16    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'array_filter'
         26        SEND_VAR                                                 !0
         27        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FSTFXS%3A16%242'
   18    28        SEND_VAL                                                 ~10
         29        SEND_VAL                                                 1
         30        DO_ICALL                                         $11     
         31        SEND_VAR                                                 $11
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FSTFXS%3A8%240

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

End of function %00%7Bclosure%7D%2Fin%2FSTFXS%3A12%241

Function %00%7Bclosure%7D%2Fin%2FSTFXS%3A16%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/STFXS
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     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
   18     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FSTFXS%3A16%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.07 ms | 1400 KiB | 17 Q