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) { return $this->filter($value); } } $array = array( ' string 1 ', 'string 2', 'string 3 ', ); foreach (new CallbackFilterIterator($array, new StringTrimFilter()) as $value) { var_dump($value); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/ZmpMr
function name:  (null)
number of ops:  16
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        SEND_VAR_EX                                              !0
          4        NEW                                              $4      'StringTrimFilter'
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $4
          7        DO_FCALL                                      0          
          8      > FE_RESET_R                                       $7      $3, ->14
          9    > > FE_FETCH_R                                               $7, !1, ->14
   24    10    >   INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   23    13      > JMP                                                      ->9
         14    >   FE_FREE                                                  $7
   25    15      > RETURN                                                   1

Class FilterInterface:
Function filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZmpMr
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/ZmpMr
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/ZmpMr
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      > RETURN                                                   $1
   14     5*     > RETURN                                                   null

End of function __invoke

End of class StringTrimFilter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.06 ms | 1400 KiB | 17 Q