3v4l.org

run code in 300+ PHP versions simultaneously
<?php $var = 'ABCDEFGH:/MNRPQR/'; echo "Original: $var<hr />\n"; /* These two examples replace all of $var with 'bob'. */ echo substr_replace($var, 'bob', 0) . "<br />\n"; echo substr_replace($var, 'bob', 0, strlen($var)) . "<br />\n"; /* Insert 'bob' right at the beginning of $var. */ echo substr_replace($var, 'bob', 0, 0) . "<br />\n"; /* These next two replace 'MNRPQR' in $var with 'bob'. */ echo substr_replace($var, 'bob', 10, -1) . "<br />\n"; echo substr_replace($var, 'bob', -7, -1) . "<br />\n"; /* Delete 'MNRPQR' from $var. */ echo substr_replace($var, '', 10, -1) . "<br />\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vQ8YO
function name:  (null)
number of ops:  54
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'ABCDEFGH%3A%2FMNRPQR%2F'
    3     1        ROPE_INIT                                     3  ~3      'Original%3A+'
          2        ROPE_ADD                                      1  ~3      ~3, !0
          3        ROPE_END                                      2  ~2      ~3, '%3Chr+%2F%3E%0A'
          4        ECHO                                                     ~2
    6     5        INIT_FCALL                                               'substr_replace'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'bob'
          8        SEND_VAL                                                 0
          9        DO_ICALL                                         $5      
         10        CONCAT                                           ~6      $5, '%3Cbr+%2F%3E%0A'
         11        ECHO                                                     ~6
    7    12        INIT_FCALL                                               'substr_replace'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 'bob'
         15        SEND_VAL                                                 0
         16        STRLEN                                           ~7      !0
         17        SEND_VAL                                                 ~7
         18        DO_ICALL                                         $8      
         19        CONCAT                                           ~9      $8, '%3Cbr+%2F%3E%0A'
         20        ECHO                                                     ~9
   10    21        INIT_FCALL                                               'substr_replace'
         22        SEND_VAR                                                 !0
         23        SEND_VAL                                                 'bob'
         24        SEND_VAL                                                 0
         25        SEND_VAL                                                 0
         26        DO_ICALL                                         $10     
         27        CONCAT                                           ~11     $10, '%3Cbr+%2F%3E%0A'
         28        ECHO                                                     ~11
   13    29        INIT_FCALL                                               'substr_replace'
         30        SEND_VAR                                                 !0
         31        SEND_VAL                                                 'bob'
         32        SEND_VAL                                                 10
         33        SEND_VAL                                                 -1
         34        DO_ICALL                                         $12     
         35        CONCAT                                           ~13     $12, '%3Cbr+%2F%3E%0A'
         36        ECHO                                                     ~13
   14    37        INIT_FCALL                                               'substr_replace'
         38        SEND_VAR                                                 !0
         39        SEND_VAL                                                 'bob'
         40        SEND_VAL                                                 -7
         41        SEND_VAL                                                 -1
         42        DO_ICALL                                         $14     
         43        CONCAT                                           ~15     $14, '%3Cbr+%2F%3E%0A'
         44        ECHO                                                     ~15
   17    45        INIT_FCALL                                               'substr_replace'
         46        SEND_VAR                                                 !0
         47        SEND_VAL                                                 ''
         48        SEND_VAL                                                 10
         49        SEND_VAL                                                 -1
         50        DO_ICALL                                         $16     
         51        CONCAT                                           ~17     $16, '%3Cbr+%2F%3E%0A'
         52        ECHO                                                     ~17
   18    53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.4 ms | 1400 KiB | 15 Q