3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [0, 1, 2]; for($i = 0; $i <= 2; $i++){ $filtered = array_values(array_filter($array, function($elem) use ($i){ return ($elem == $i); })); var_dump($filtered); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 3
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 3
Branch analysis from position: 19
Branch analysis from position: 3
filename:       /in/X1iSF
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array, !1 = $i, !2 = $filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->17
    4     3    >   INIT_FCALL                                               'array_values'
          4        INIT_FCALL                                               'array_filter'
          5        SEND_VAR                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          7        BIND_LEXICAL                                             ~5, !1
    6     8        SEND_VAL                                                 ~5
    4     9        DO_ICALL                                         $6      
    6    10        SEND_VAR                                                 $6
    4    11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !2, $7
    7    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
    3    16        PRE_INC                                                  !1
         17    >   IS_SMALLER_OR_EQUAL                                      !1, 2
         18      > JMPNZ                                                    ~11, ->3
    8    19    > > RETURN                                                   1


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

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
121.02 ms | 1429 KiB | 16 Q