3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = range(0, 1e6); echo memory_get_peak_usage()/1024 . 'kB' . PHP_EOL; foreach ($array as $i => $a) { echo $a; } echo memory_get_peak_usage()/1024 . 'kB';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/HM43b
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $a, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 1.0e+6
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
    4     5        INIT_FCALL                                               'memory_get_peak_usage'
          6        DO_ICALL                                         $5      
          7        DIV                                              ~6      $5, 1024
          8        CONCAT                                           ~7      ~6, 'kB'
          9        CONCAT                                           ~8      ~7, '%0A'
         10        ECHO                                                     ~8
    5    11      > FE_RESET_R                                       $9      !0, ->16
         12    > > FE_FETCH_R                                       ~10     $9, !1, ->16
         13    >   ASSIGN                                                   !2, ~10
    6    14        ECHO                                                     !1
    5    15      > JMP                                                      ->12
         16    >   FE_FREE                                                  $9
    8    17        INIT_FCALL                                               'memory_get_peak_usage'
         18        DO_ICALL                                         $12     
         19        DIV                                              ~13     $12, 1024
         20        CONCAT                                           ~14     ~13, 'kB'
         21        ECHO                                                     ~14
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.95 ms | 1395 KiB | 17 Q