3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = range(1, 10000); $start_time = microtime(true); $start_memory = memory_get_peak_usage(true); foreach($array AS $key=>$value){ $array[$key] = 'foo'; } $end_time = microtime(true); $end_memory = memory_get_peak_usage(true); echo "Time: " . ($end_time - $start_time) . PHP_EOL; echo "Memory: " . ($end_memory - $start_memory) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/BuZUQ
function name:  (null)
number of ops:  37
compiled vars:  !0 = $array, !1 = $start_time, !2 = $start_memory, !3 = $value, !4 = $key, !5 = $end_time, !6 = $end_memory
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'range'
          1        SEND_VAL                                                     1
          2        SEND_VAL                                                     10000
          3        DO_ICALL                                             $7      
          4        ASSIGN                                                       !0, $7
    4     5        INIT_FCALL                                                   'microtime'
          6        SEND_VAL                                                     <true>
          7        DO_ICALL                                             $9      
          8        ASSIGN                                                       !1, $9
    5     9        INIT_FCALL                                                   'memory_get_peak_usage'
         10        SEND_VAL                                                     <true>
         11        DO_ICALL                                             $11     
         12        ASSIGN                                                       !2, $11
    7    13      > FE_RESET_R                                           $13     !0, ->19
         14    > > FE_FETCH_R                                           ~14     $13, !3, ->19
         15    >   ASSIGN                                                       !4, ~14
    8    16        ASSIGN_DIM                                                   !0, !4
         17        OP_DATA                                                      'foo'
    7    18      > JMP                                                          ->14
         19    >   FE_FREE                                                      $13
   11    20        INIT_FCALL                                                   'microtime'
         21        SEND_VAL                                                     <true>
         22        DO_ICALL                                             $17     
         23        ASSIGN                                                       !5, $17
   12    24        INIT_FCALL                                                   'memory_get_peak_usage'
         25        SEND_VAL                                                     <true>
         26        DO_ICALL                                             $19     
         27        ASSIGN                                                       !6, $19
   14    28        SUB                                                  ~21     !5, !1
         29        CONCAT                                               ~22     'Time%3A+', ~21
         30        CONCAT                                               ~23     ~22, '%0A'
         31        ECHO                                                         ~23
   16    32        SUB                                                  ~24     !6, !2
         33        CONCAT                                               ~25     'Memory%3A+', ~24
         34        CONCAT                                               ~26     ~25, '%0A'
         35        ECHO                                                         ~26
         36      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.53 ms | 1667 KiB | 11 Q