3v4l.org

run code in 500+ PHP versions simultaneously
<?php $INDENT = 0; trait ShowMethodCalls { private function show($method) { global $INDENT; printf("%s%s::%s\n", str_repeat("> ", $INDENT++), __CLASS__, $method); $return = parent::$method(); $INDENT--; return $return; } public function accept() { return $this->show(__FUNCTION__); } public function current() { return $this->show(__FUNCTION__); } public function key() { return $this->show(__FUNCTION__); } public function next() { return $this->show(__FUNCTION__); } public function rewind() { return $this->show(__FUNCTION__); } public function valid() { return $this->show(__FUNCTION__); } } class TestFilterIterator extends FilterIterator { public function accept() { echo __FUNCTION__, PHP_EOL; return (bool)parent::current(); } } class ArrayIterator_ extends ArrayIterator { use ShowMethodCalls; } class TestFilterIterator_ extends TestFilterIterator { use ShowMethodCalls; } class LimitIterator_ extends LimitIterator { use ShowMethodCalls; } $iterator = new ArrayIterator_(array('0', 'a', '0', 'b', '0', 'c', '0', 'd')); $iterator = new TestFilterIterator_($iterator); $iterator = new LimitIterator_($iterator, 0, 2); foreach ($iterator as $k => $v) { var_dump([$k, $v]); }

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 27
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/U61Ii
function name:  (null)
number of ops:  29
compiled vars:  !0 = $INDENT, !1 = $iterator, !2 = $v, !3 = $k
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 0
   30     1        DECLARE_CLASS                                                'arrayiterator_', 'arrayiterator'
   33     2        DECLARE_CLASS                                                'testfilteriterator_', 'testfilteriterator'
   36     3        DECLARE_CLASS                                                'limititerator_', 'limititerator'
   40     4        NEW                                                  $5      'ArrayIterator_'
          5        SEND_VAL_EX                                                  <array>
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $5
   41     8        NEW                                                  $8      'TestFilterIterator_'
          9        SEND_VAR_EX                                                  !1
         10        DO_FCALL                                          0          
         11        ASSIGN                                                       !1, $8
   42    12        NEW                                                  $11     'LimitIterator_'
         13        SEND_VAR_EX                                                  !1
         14        SEND_VAL_EX                                                  0
         15        SEND_VAL_EX                                                  2
         16        DO_FCALL                                          0          
         17        ASSIGN                                                       !1, $11
   43    18      > FE_RESET_R                                           $14     !1, ->27
         19    > > FE_FETCH_R                                           ~15     $14, !2, ->27
         20    >   ASSIGN                                                       !3, ~15
   44    21        INIT_FCALL                                                   'var_dump'
         22        INIT_ARRAY                                           ~17     !3
         23        ADD_ARRAY_ELEMENT                                    ~17     !2
         24        SEND_VAL                                                     ~17
         25        DO_ICALL                                                     
   43    26      > JMP                                                          ->19
         27    >   FE_FREE                                                      $14
   45    28      > RETURN                                                       1

Class ShowMethodCalls:
Function show:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U61Ii
function name:  show
number of ops:  20
compiled vars:  !0 = $method, !1 = $INDENT, !2 = $return
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        BIND_GLOBAL                                                  !1, 'INDENT'
    8     2        INIT_FCALL                                                   'printf'
          3        SEND_VAL                                                     '%25s%25s%3A%3A%25s%0A'
          4        INIT_FCALL                                                   'str_repeat'
          5        SEND_VAL                                                     '%3E+'
          6        POST_INC                                             ~3      !1
          7        SEND_VAL                                                     ~3
          8        DO_ICALL                                             $4      
          9        SEND_VAR                                                     $4
         10        FETCH_CLASS_NAME                                     ~5      
         11        SEND_VAL                                                     ~5
         12        SEND_VAR                                                     !0
         13        DO_ICALL                                                     
    9    14        INIT_STATIC_METHOD_CALL                                      !0
         15        DO_FCALL                                          0  $7      
         16        ASSIGN                                                       !2, $7
   10    17        PRE_DEC                                                      !1
   11    18      > RETURN                                                       !2
   12    19*     > RETURN                                                       null

End of function show

Function accept:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U61Ii
function name:  accept
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_METHOD_CALL                                             'show'
          1        SEND_VAL_EX                                                  'accept'
          2        DO_FCALL                                          0  $0      
          3      > RETURN                                                       $0
          4*     > RETURN                                                       null

End of function accept

Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U61Ii
function name:  current
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   INIT_METHOD_CALL                                             'show'
          1        SEND_VAL_EX                                                  'current'
          2        DO_FCALL                                          0  $0      
          3      > RETURN                                                       $0
          4*     > RETURN                                                       null

End of function current

Function key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U61Ii
function name:  key
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   INIT_METHOD_CALL                                             'show'
          1        SEND_VAL_EX                                                  'key'
          2        DO_FCALL                                          0  $0      
          3      > RETURN                                                       $0
          4*     > RETURN                                                       null

End of function key

Function next:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U61Ii
function name:  next
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   INIT_METHOD_CALL                                             'show'
          1        SEND_VAL_EX                                                  'next'
          2        DO_FCALL                                          0  $0      
          3      > RETURN                                                       $0
          4*     > RETURN                                                       null

End of function next

Function rewind:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U61Ii
function name:  rewind
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   INIT_METHOD_CALL                                             'show'
          1        SEND_VAL_EX                                                  'rewind'
          2        DO_FCALL                                          0  $0      
          3      > RETURN                                                       $0
          4*     > RETURN                                                       null

End of function rewind

Function valid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U61Ii
function name:  valid
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   INIT_METHOD_CALL                                             'show'
          1        SEND_VAL_EX                                                  'valid'
          2        DO_FCALL                                          0  $0      
          3      > RETURN                                                       $0
          4*     > RETURN                                                       null

End of function valid

End of class ShowMethodCalls.

Class TestFilterIterator:
Function accept:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U61Ii
function name:  accept
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   ECHO                                                         'accept'
          1        ECHO                                                         '%0A'
   26     2        INIT_STATIC_METHOD_CALL                                      'current'
          3        DO_FCALL                                          0  $0      
          4        BOOL                                                 ~1      $0
          5      > RETURN                                                       ~1
   27     6*     > RETURN                                                       null

End of function accept

End of class TestFilterIterator.

Class ArrayIterator_: [no user functions]
Class TestFilterIterator_: [no user functions]
Class LimitIterator_: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.05 ms | 2528 KiB | 11 Q