3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(1,2,3,4,5,6,7,8,9,10); $key = 2; foreach (new CallbackFilterIterator(new ArrayIterator($a), function($v, $k) use ($key) { static $good = false; $good |= $k === $key; return $good; }) as $v) { echo $v; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/5Iksl
function name:  (null)
number of ops:  17
compiled vars:  !0 = $a, !1 = $key, !2 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 2
    4     2        NEW                                              $5      'CallbackFilterIterator'
          3        NEW                                              $6      'ArrayIterator'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $6
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5Iksl%3A4%240'
          8        BIND_LEXICAL                                             ~8, !1
          9        SEND_VAL_EX                                              ~8
         10        DO_FCALL                                      0          
         11      > FE_RESET_R                                       $10     $5, ->15
         12    > > FE_FETCH_R                                               $10, !2, ->15
    5    13    >   ECHO                                                     !2
    4    14      > JMP                                                      ->12
         15    >   FE_FREE                                                  $10
    6    16      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2F5Iksl%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.62 ms | 1395 KiB | 13 Q