3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = str_repeat('abcde', 500000); $insertion = 'abc'; $position = 0; $data = substr($data, 0, $position) . $insertion . substr($data, $position); echo memory_get_peak_usage(), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UV3Is
function name:  (null)
number of ops:  24
compiled vars:  !0 = $data, !1 = $insertion, !2 = $position
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'str_repeat'
          1        SEND_VAL                                                 'abcde'
          2        SEND_VAL                                                 500000
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
    4     5        ASSIGN                                                   !1, 'abc'
    5     6        ASSIGN                                                   !2, 0
    7     7        INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 0
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $7      
         12        CONCAT                                           ~8      $7, !1
         13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $9      
         17        CONCAT                                           ~10     ~8, $9
         18        ASSIGN                                                   !0, ~10
    9    19        INIT_FCALL                                               'memory_get_peak_usage'
         20        DO_ICALL                                         $12     
         21        ECHO                                                     $12
         22        ECHO                                                     '%0A'
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.42 ms | 1003 KiB | 16 Q