3v4l.org

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

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

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.92 ms | 1403 KiB | 22 Q