3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace itertools; function filter(\Traversable $iterator, callable $callback = null) { foreach ($iterator as $key => $val) { if (null !== $callback and $callback($val, $key)) { (yield $key => $val); } else if ($val) { (yield $key => $val); } } } $a = new \ArrayObject(["foo", "bar", 0, "baz"]); foreach (filter($a) as $val) { print_r($val); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/IpXud
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $2      'ArrayObject'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   18     4        INIT_NS_FCALL_BY_NAME                                    'itertools%5Cfilter'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $5      
          7      > FE_RESET_R                                       $6      $5, ->13
          8    > > FE_FETCH_R                                               $6, !1, ->13
   19     9    >   INIT_NS_FCALL_BY_NAME                                    'itertools%5Cprint_r'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
   18    12      > JMP                                                      ->8
         13    >   FE_FREE                                                  $6
   20    14      > RETURN                                                   1

Function itertools%5Cfilter:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
Branch analysis from position: 13
Branch analysis from position: 19
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 19
filename:       /in/IpXud
function name:  itertools\filter
number of ops:  21
compiled vars:  !0 = $iterator, !1 = $callback, !2 = $val, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
          2        GENERATOR_CREATE                                         
    7     3      > FE_RESET_R                                       $4      !0, ->19
          4    > > FE_FETCH_R                                       ~5      $4, !2, ->19
          5    >   ASSIGN                                                   !3, ~5
    8     6        TYPE_CHECK                                  1020  ~7      !1
          7      > JMPZ_EX                                          ~7      ~7, ->13
          8    >   INIT_DYNAMIC_CALL                                        !1
          9        SEND_VAR_EX                                              !2
         10        SEND_VAR_EX                                              !3
         11        DO_FCALL                                      0  $8      
         12        BOOL                                             ~7      $8
         13    > > JMPZ                                                     ~7, ->16
    9    14    >   YIELD                                                    !2, !3
         15      > JMP                                                      ->18
   10    16    > > JMPZ                                                     !2, ->18
   11    17    >   YIELD                                                    !2, !3
    7    18    > > JMP                                                      ->4
         19    >   FE_FREE                                                  $4
   14    20      > GENERATOR_RETURN                                         

End of function itertools%5Cfilter

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.14 ms | 1403 KiB | 16 Q