3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "pomo"; $pos = 2; $str_to_replace = "aa"; $new_str = substr($str, 0, ($pos-1)).$str_to_replace.substr($str, $pos); echo $new_str;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WPQFR
function name:  (null)
number of ops:  18
compiled vars:  !0 = $str, !1 = $pos, !2 = $str_to_replace, !3 = $new_str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'pomo'
    3     1        ASSIGN                                                   !1, 2
    4     2        ASSIGN                                                   !2, 'aa'
    6     3        INIT_FCALL                                               'substr'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 0
          6        SUB                                              ~7      !1, 1
          7        SEND_VAL                                                 ~7
          8        DO_ICALL                                         $8      
          9        CONCAT                                           ~9      $8, !2
         10        INIT_FCALL                                               'substr'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $10     
         14        CONCAT                                           ~11     ~9, $10
         15        ASSIGN                                                   !3, ~11
    8    16        ECHO                                                     !3
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.58 ms | 1394 KiB | 15 Q