3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface FilterInterface { public function filter($value); } class StringTrimFilter implements FilterInterface { public function filter($value) { return trim($value); } public function __invoke(&$value) { $value = $this->filter($value); } } $array = array( ' string 1 ', 'string 2', 'string 3 ', ); foreach (new CallbackFilterIterator(new ArrayIterator($array), new StringTrimFilter()) as $value) { var_dump($value); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/TruQK
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'stringtrimfilter'
   17     1        ASSIGN                                                   !0, <array>
   23     2        NEW                                              $3      'CallbackFilterIterator'
          3        NEW                                              $4      'ArrayIterator'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $4
          7        NEW                                              $6      'StringTrimFilter'
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $6
         10        DO_FCALL                                      0          
         11      > FE_RESET_R                                       $9      $3, ->17
         12    > > FE_FETCH_R                                               $9, !1, ->17
   24    13    >   INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
   23    16      > JMP                                                      ->12
         17    >   FE_FREE                                                  $9
   25    18      > RETURN                                                   1

Class FilterInterface:
Function filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TruQK
function name:  filter
number of ops:  2
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function filter

End of class FilterInterface.

Class StringTrimFilter:
Function filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TruQK
function name:  filter
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'trim'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   10     5*     > RETURN                                                   null

End of function filter

Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TruQK
function name:  __invoke
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_METHOD_CALL                                         'filter'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   14     5      > RETURN                                                   null

End of function __invoke

End of class StringTrimFilter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.98 ms | 1392 KiB | 17 Q