3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Container implements Iterator { private $container; private $iterator; public function __construct() { $this->container = new ArrayObject(); $this->iterator = $this->container->getIterator(); } public function get_iterator() { return $this->iterator; } public function append($element) { $this->container->append($element); } public function current() { return $this->iterator->current(); } public function next() { $this->iterator->next(); } public function key() { return $this->iterator->key(); } public function valid() { return $this->iterator->valid(); } public function rewind() { $this->iterator->rewind(); } } class Page { private $content; public function __construct($content) { $this->content = $content; } public function get_content() { return $this->content; } } $container = new Container(); $container->append('test1'); $container->append('test2'); $serialized = serialize($container); unset($container); $container = unserialize($serialized); foreach ($container as $key => $value) { echo $key . ' => ' . $value . PHP_EOL; } echo $serialized . PHP_EOL; var_dump($container); var_dump($container->get_iterator());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/ATKBK
function name:  (null)
number of ops:  39
compiled vars:  !0 = $container, !1 = $serialized, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'container'
   65     1        NEW                                              $4      'Container'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
   66     4        INIT_METHOD_CALL                                         !0, 'append'
          5        SEND_VAL_EX                                              'test1'
          6        DO_FCALL                                      0          
   67     7        INIT_METHOD_CALL                                         !0, 'append'
          8        SEND_VAL_EX                                              'test2'
          9        DO_FCALL                                      0          
   69    10        INIT_FCALL                                               'serialize'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !1, $9
   70    14        UNSET_CV                                                 !0
   72    15        INIT_FCALL                                               'unserialize'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $11     
         18        ASSIGN                                                   !0, $11
   73    19      > FE_RESET_R                                       $13     !0, ->27
         20    > > FE_FETCH_R                                       ~14     $13, !2, ->27
         21    >   ASSIGN                                                   !3, ~14
   75    22        CONCAT                                           ~16     !3, '+%3D%3E+'
         23        CONCAT                                           ~17     ~16, !2
         24        CONCAT                                           ~18     ~17, '%0A'
         25        ECHO                                                     ~18
   73    26      > JMP                                                      ->20
         27    >   FE_FREE                                                  $13
   78    28        CONCAT                                           ~19     !1, '%0A'
         29        ECHO                                                     ~19
   79    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
   80    33        INIT_FCALL                                               'var_dump'
         34        INIT_METHOD_CALL                                         !0, 'get_iterator'
         35        DO_FCALL                                      0  $21     
         36        SEND_VAR                                                 $21
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Class Container:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ATKBK
function name:  __construct
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'ArrayObject'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'container'
          3        OP_DATA                                                  $1
   11     4        FETCH_OBJ_R                                      ~4      'container'
          5        INIT_METHOD_CALL                                         ~4, 'getIterator'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN_OBJ                                               'iterator'
          8        OP_DATA                                                  $5
   12     9      > RETURN                                                   null

End of function __construct

Function get_iterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ATKBK
function name:  get_iterator
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                      ~0      'iterator'
          1      > RETURN                                                   ~0
   17     2*     > RETURN                                                   null

End of function get_iterator

Function append:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ATKBK
function name:  append
number of ops:  6
compiled vars:  !0 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        FETCH_OBJ_R                                      ~1      'container'
          2        INIT_METHOD_CALL                                         ~1, 'append'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   22     5      > RETURN                                                   null

End of function append

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

End of function current

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

End of function next

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

End of function key

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

End of function valid

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

End of function rewind

End of class Container.

Class Page:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ATKBK
function name:  __construct
number of ops:  4
compiled vars:  !0 = $content
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   54     0  E >   RECV                                             !0      
   56     1        ASSIGN_OBJ                                               'content'
          2        OP_DATA                                                  !0
   57     3      > RETURN                                                   null

End of function __construct

Function get_content:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ATKBK
function name:  get_content
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   FETCH_OBJ_R                                      ~0      'content'
          1      > RETURN                                                   ~0
   62     2*     > RETURN                                                   null

End of function get_content

End of class Page.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.78 ms | 949 KiB | 20 Q