3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numbers = range(1, 10); function printNumbers() { global $numbers; foreach ($numbers as $number) { echo $number . ', '; } } //$numbers =& $numbers; //<---- by reference (var.name does not matter) provides alternative behavour foreach ($numbers as $number) { echo $number . ": "; printNumbers(); echo "\n"; } // EXAMPLE 2: $numbers = range(1, 10); foreach ($numbers as $skip) { echo $skip . ','; next($numbers); } echo "\n"; // alternative behavour when using by-reference $numbers2 =& $numbers; foreach ($numbers2 as $skip) { echo $skip . ','; next($numbers2); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 13
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
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 38
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 38
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 27
Branch analysis from position: 13
filename:       /in/3UUK3
function name:  (null)
number of ops:  40
compiled vars:  !0 = $numbers, !1 = $number, !2 = $skip, !3 = $numbers2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 10
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
   11     5      > FE_RESET_R                                       $6      !0, ->13
          6    > > FE_FETCH_R                                               $6, !1, ->13
   12     7    >   CONCAT                                           ~7      !1, '%3A+'
          8        ECHO                                                     ~7
   13     9        INIT_FCALL                                               'printnumbers'
         10        DO_FCALL                                      0          
   14    11        ECHO                                                     '%0A'
   11    12      > JMP                                                      ->6
         13    >   FE_FREE                                                  $6
   18    14        INIT_FCALL                                               'range'
         15        SEND_VAL                                                 1
         16        SEND_VAL                                                 10
         17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !0, $9
   19    19      > FE_RESET_R                                       $11     !0, ->27
         20    > > FE_FETCH_R                                               $11, !2, ->27
   20    21    >   CONCAT                                           ~12     !2, '%2C'
         22        ECHO                                                     ~12
   21    23        INIT_FCALL                                               'next'
         24        SEND_REF                                                 !0
         25        DO_ICALL                                                 
   19    26      > JMP                                                      ->20
         27    >   FE_FREE                                                  $11
   23    28        ECHO                                                     '%0A'
   26    29        ASSIGN_REF                                               !3, !0
   27    30      > FE_RESET_R                                       $15     !3, ->38
         31    > > FE_FETCH_R                                               $15, !2, ->38
   28    32    >   CONCAT                                           ~16     !2, '%2C'
         33        ECHO                                                     ~16
   29    34        INIT_FCALL                                               'next'
         35        SEND_REF                                                 !3
         36        DO_ICALL                                                 
   27    37      > JMP                                                      ->31
         38    >   FE_FREE                                                  $15
   30    39      > RETURN                                                   1

Function printnumbers:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/3UUK3
function name:  printNumbers
number of ops:  8
compiled vars:  !0 = $numbers, !1 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   BIND_GLOBAL                                              !0, 'numbers'
    5     1      > FE_RESET_R                                       $2      !0, ->6
          2    > > FE_FETCH_R                                               $2, !1, ->6
    6     3    >   CONCAT                                           ~3      !1, '%2C+'
          4        ECHO                                                     ~3
    5     5      > JMP                                                      ->2
          6    >   FE_FREE                                                  $2
    8     7      > RETURN                                                   null

End of function printnumbers

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.42 ms | 1403 KiB | 18 Q