3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numbers = ['one', 'two', 'three']; // Normal foreach loop, no reference used foreach ($numbers as $number) { // Does not affect the original array, only modifies // $number within the scope of the loop $number = strtoupper($number); } // Will dump unmodified array: ['one', 'two', 'three'] var_dump($numbers); // Foreach loop by reference foreach ($numbers as &$number) { // $number is a reference so the corresponding // value in $numbers is also updated $number = strtoupper($number); } // Will dump: ['ONE', 'TWO', 'THREE'] var_dump($numbers);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
2 jumps found. (Code = 125) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 126) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 8
filename:       /in/QtdhK
function name:  (null)
number of ops:  24
compiled vars:  !0 = $numbers, !1 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1      > FE_RESET_R                                       $3      !0, ->8
          2    > > FE_FETCH_R                                               $3, !1, ->8
   10     3    >   INIT_FCALL                                               'strtoupper'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !1, $4
    6     7      > JMP                                                      ->2
          8    >   FE_FREE                                                  $3
   14     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   17    12      > FE_RESET_RW                                      $7      !0, ->19
         13    > > FE_FETCH_RW                                              $7, !1, ->19
   21    14    >   INIT_FCALL                                               'strtoupper'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $8      
         17        ASSIGN                                                   !1, $8
   17    18      > JMP                                                      ->13
         19    >   FE_FREE                                                  $7
   25    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.11 ms | 999 KiB | 15 Q