3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { private $a = 1; protected $b = 2; public $c = 3; private $d = 4; protected $e = 5; public $f = 6; } $obj = new test; echo "BROKEN:\n"; var_dump(reset($obj)); var_dump(current($obj)); var_dump(next($obj)); var_dump(prev($obj)); var_dump(end($obj)); echo "\nWORKING:\n"; foreach ($obj as $item) { var_dump($item); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 41
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/5e6Ok
function name:  (null)
number of ops:  43
compiled vars:  !0 = $obj, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $2      'test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   14     3        ECHO                                                     'BROKEN%3A%0A'
   15     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'reset'
          6        SEND_REF                                                 !0
          7        DO_ICALL                                         $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                                 
   16    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'current'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                                 
   17    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'next'
         18        SEND_REF                                                 !0
         19        DO_ICALL                                         $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                                 
   18    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'prev'
         24        SEND_REF                                                 !0
         25        DO_ICALL                                         $11     
         26        SEND_VAR                                                 $11
         27        DO_ICALL                                                 
   19    28        INIT_FCALL                                               'var_dump'
         29        INIT_FCALL                                               'end'
         30        SEND_REF                                                 !0
         31        DO_ICALL                                         $13     
         32        SEND_VAR                                                 $13
         33        DO_ICALL                                                 
   21    34        ECHO                                                     '%0AWORKING%3A%0A'
   22    35      > FE_RESET_R                                       $15     !0, ->41
         36    > > FE_FETCH_R                                               $15, !1, ->41
   23    37    >   INIT_FCALL                                               'var_dump'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                                 
   22    40      > JMP                                                      ->36
         41    >   FE_FREE                                                  $15
   24    42      > RETURN                                                   1

Class test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
198.39 ms | 1400 KiB | 25 Q