3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_array_filter(array $array, ?callable $callback = null) { $callback ??= static fn(mixed $item) => (bool) $item; $filtered = []; foreach ($array as $item) { $callback($item) and $filtered[] = $item; } return $filtered; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EB6nl
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                   1

Function my_array_filter:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/EB6nl
function name:  my_array_filter
number of ops:  21
compiled vars:  !0 = $array, !1 = $callback, !2 = $filtered, !3 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    5     2        COALESCE                                         ~4      !1
          3        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          4        ASSIGN                                           ~6      !1, ~5
          5        QM_ASSIGN                                        ~4      ~6
          6        FREE                                                     ~4
    7     7        ASSIGN                                                   !2, <array>
    8     8      > FE_RESET_R                                       $8      !0, ->18
          9    > > FE_FETCH_R                                               $8, !3, ->18
    9    10    >   INIT_DYNAMIC_CALL                                        !1
         11        SEND_VAR_EX                                              !3
         12        DO_FCALL                                      0  $9      
         13      > JMPZ_EX                                          ~10     $9, ->17
         14    >   ASSIGN_DIM                                       ~11     !2
         15        OP_DATA                                                  !3
         16        BOOL                                             ~10     ~11
    8    17    > > JMP                                                      ->9
         18    >   FE_FREE                                                  $8
   11    19      > RETURN                                                   !2
   12    20*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EB6nl
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BOOL                                             ~1      !0
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of Dynamic Function 0

End of function my_array_filter

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.99 ms | 1008 KiB | 13 Q