3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { static $data = array( array('site_name' => 'bar'), array(), array('site_name' => 'baz') ); $current = current($data); next($data); return $current; } while ($bar = foo()) echo $bar['site_name']."\n"; echo '-------------------------------------------'."\n"; while (($bar = foo) !== false) echo $bar['site_name']."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 1
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
Branch analysis from position: 10
Branch analysis from position: 1
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 1
Branch analysis from position: 8
Branch analysis from position: 1
filename:       /in/dMblk
function name:  (null)
number of ops:  18
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > JMP                                                      ->4
          1    >   FETCH_DIM_R                                      ~1      !0, 'site_name'
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
          4    >   INIT_FCALL                                               'foo'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                           ~4      !0, $3
          7      > JMPNZ                                                    ~4, ->1
   16     8    >   ECHO                                                     '-------------------------------------------%0A'
   17     9      > JMP                                                      ->13
         10    >   FETCH_DIM_R                                      ~5      !0, 'site_name'
         11        CONCAT                                           ~6      ~5, '%0A'
         12        ECHO                                                     ~6
         13    >   FETCH_CONSTANT                                   ~7      'foo'
         14        ASSIGN                                           ~8      !0, ~7
         15        TYPE_CHECK                                  1018          ~8
         16      > JMPNZ                                                    ~9, ->10
         17    > > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dMblk
function name:  foo
number of ops:  10
compiled vars:  !0 = $data, !1 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   BIND_STATIC                                              !0
    9     1        INIT_FCALL                                               'current'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   10     5        INIT_FCALL                                               'next'
          6        SEND_REF                                                 !0
          7        DO_ICALL                                                 
   12     8      > RETURN                                                   !1
   13     9*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.31 ms | 1403 KiB | 18 Q