3v4l.org

run code in 500+ PHP versions simultaneously
<?php class CustomArrayIterator extends ArrayIterator { public function current(){ return "CustomArrayIterator::current called"; } } class Some extends ArrayObject { function __construct(){ parent::__construct(array("key"=>"storged value"),ArrayObject::ARRAY_AS_PROPS,CustomArrayIterator::class); } } $obj=new Some(); print $obj->key."<br>"; foreach($obj as $key=>$val){ print $val."<br>"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/7tMHH
function name:  (null)
number of ops:  14
compiled vars:  !0 = $obj, !1 = $val, !2 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   NEW                                                  $3      'Some'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
   16     3        FETCH_OBJ_R                                          ~6      !0, 'key'
          4        CONCAT                                               ~7      ~6, '%3Cbr%3E'
          5        ECHO                                                         ~7
   17     6      > FE_RESET_R                                           $8      !0, ->12
          7    > > FE_FETCH_R                                           ~9      $8, !1, ->12
          8    >   ASSIGN                                                       !2, ~9
   18     9        CONCAT                                               ~11     !1, '%3Cbr%3E'
         10        ECHO                                                         ~11
   17    11      > JMP                                                          ->7
         12    >   FE_FREE                                                      $8
   19    13      > RETURN                                                       1

Class CustomArrayIterator:
Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7tMHH
function name:  current
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                       'CustomArrayIterator%3A%3Acurrent+called'
    6     1*     > RETURN                                                       null

End of function current

End of class CustomArrayIterator.

Class Some:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7tMHH
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   INIT_STATIC_METHOD_CALL                                      
          1        SEND_VAL_EX                                                  <array>
          2        SEND_VAL_EX                                                  2
          3        SEND_VAL_EX                                                  'CustomArrayIterator'
          4        DO_FCALL                                          0          
   12     5      > RETURN                                                       null

End of function __construct

End of class Some.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
141.23 ms | 2324 KiB | 13 Q