3v4l.org

run code in 500+ 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:  18
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        FRAMELESS_ICALL_3                substr              ~7      !0, 0
          8        OP_DATA                                                      !2
          9        CONCAT                                               ~8      ~7, !1
         10        FRAMELESS_ICALL_2                substr              ~9      !0, !2
         11        CONCAT                                               ~10     ~8, ~9
         12        ASSIGN                                                       !0, ~10
    9    13        INIT_FCALL                                                   'memory_get_peak_usage'
         14        DO_ICALL                                             $12     
         15        ECHO                                                         $12
         16        ECHO                                                         '%0A'
         17      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
198.03 ms | 2611 KiB | 15 Q