3v4l.org

run code in 300+ PHP versions simultaneously
<?php $p = 1; for ($i = 1; $i <= 3; $i++) { echo '$p before calculation: ' . $p . PHP_EOL; for ($k = 1; $k <= $i; $k++) { $p = $p * 3; } echo '$p after calculation: ' . $p . PHP_EOL; } echo '$p at end of script: ' . $p . PHP_EOL; echo '=====' . PHP_EOL; unset($p); // just for having both examples at once for ($i = 1; $i <= 3; $i++) { $p = 1; echo '$p before calculation: ' . $p . PHP_EOL; for ($k = 1; $k <= $i; $k++) { $p = $p * 3; } echo '$p after calculation: ' . $p . PHP_EOL; } echo '$p at end of script: ' . $p . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 3
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 26
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 32
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 26
Branch analysis from position: 43
Branch analysis from position: 26
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 32
Branch analysis from position: 37
Branch analysis from position: 32
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 3
Branch analysis from position: 19
Branch analysis from position: 3
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/WKtJC
function name:  (null)
number of ops:  47
compiled vars:  !0 = $p, !1 = $i, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 1
    5     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->17
    6     3    >   CONCAT                                           ~5      '%24p+before+calculation%3A+', !0
          4        CONCAT                                           ~6      ~5, '%0A'
          5        ECHO                                                     ~6
    7     6        ASSIGN                                                   !2, 1
          7      > JMP                                                      ->11
    8     8    >   MUL                                              ~8      !0, 3
          9        ASSIGN                                                   !0, ~8
    7    10        PRE_INC                                                  !2
         11    >   IS_SMALLER_OR_EQUAL                                      !2, !1
         12      > JMPNZ                                                    ~11, ->8
   10    13    >   CONCAT                                           ~12     '%24p+after+calculation%3A+', !0
         14        CONCAT                                           ~13     ~12, '%0A'
         15        ECHO                                                     ~13
    5    16        PRE_INC                                                  !1
         17    >   IS_SMALLER_OR_EQUAL                                      !1, 3
         18      > JMPNZ                                                    ~15, ->3
   13    19    >   CONCAT                                           ~16     '%24p+at+end+of+script%3A+', !0
         20        CONCAT                                           ~17     ~16, '%0A'
         21        ECHO                                                     ~17
   15    22        ECHO                                                     '%3D%3D%3D%3D%3D%0A'
   18    23        UNSET_CV                                                 !0
   20    24        ASSIGN                                                   !1, 1
         25      > JMP                                                      ->41
   21    26    >   ASSIGN                                                   !0, 1
   22    27        CONCAT                                           ~20     '%24p+before+calculation%3A+', !0
         28        CONCAT                                           ~21     ~20, '%0A'
         29        ECHO                                                     ~21
   23    30        ASSIGN                                                   !2, 1
         31      > JMP                                                      ->35
   24    32    >   MUL                                              ~23     !0, 3
         33        ASSIGN                                                   !0, ~23
   23    34        PRE_INC                                                  !2
         35    >   IS_SMALLER_OR_EQUAL                                      !2, !1
         36      > JMPNZ                                                    ~26, ->32
   26    37    >   CONCAT                                           ~27     '%24p+after+calculation%3A+', !0
         38        CONCAT                                           ~28     ~27, '%0A'
         39        ECHO                                                     ~28
   20    40        PRE_INC                                                  !1
         41    >   IS_SMALLER_OR_EQUAL                                      !1, 3
         42      > JMPNZ                                                    ~30, ->26
   29    43    >   CONCAT                                           ~31     '%24p+at+end+of+script%3A+', !0
         44        CONCAT                                           ~32     ~31, '%0A'
         45        ECHO                                                     ~32
   30    46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.91 ms | 1000 KiB | 13 Q