3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo substr_replace('stack', 'i', 2, 1) . PHP_EOL; // stick echo substr_replace('stack', 'u', -3, 1) . PHP_EOL; // stuck echo substr_replace('stack', 'o', 1, 2) . PHP_EOL; // sock echo substr_replace('stack', 'ge', -2, 2) . PHP_EOL; // stage echo substr_replace('stack', 'bri', 0, 3) . PHP_EOL; // brick echo substr_replace('stack', 'hre', 1, -1) . PHP_EOL; // shrek echo substr_replace('stack', 'hre', -4, -1) . PHP_EOL; // shrek echo substr_replace('stack', 'y', 3, 0) . PHP_EOL; // stayck ...consume no bytes echo substr_replace('stack', 'y', 3) . PHP_EOL; // stay ...consume remaining bytes echo substr_replace('voilà', 'ci', -2) . PHP_EOL; // voilci ...à has two bytes echo substr_replace('voilà', 'ci', -3) . PHP_EOL; // voici ...à has two bytes echo substr_replace('sûreté', '', 4) . PHP_EOL; // sûr ...û has two bytes
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VNYbk
function name:  (null)
number of ops:  93
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'substr_replace'
          1        SEND_VAL                                                 'stack'
          2        SEND_VAL                                                 'i'
          3        SEND_VAL                                                 2
          4        SEND_VAL                                                 1
          5        DO_ICALL                                         $0      
          6        CONCAT                                           ~1      $0, '%0A'
          7        ECHO                                                     ~1
    4     8        INIT_FCALL                                               'substr_replace'
          9        SEND_VAL                                                 'stack'
         10        SEND_VAL                                                 'u'
         11        SEND_VAL                                                 -3
         12        SEND_VAL                                                 1
         13        DO_ICALL                                         $2      
         14        CONCAT                                           ~3      $2, '%0A'
         15        ECHO                                                     ~3
    5    16        INIT_FCALL                                               'substr_replace'
         17        SEND_VAL                                                 'stack'
         18        SEND_VAL                                                 'o'
         19        SEND_VAL                                                 1
         20        SEND_VAL                                                 2
         21        DO_ICALL                                         $4      
         22        CONCAT                                           ~5      $4, '%0A'
         23        ECHO                                                     ~5
    6    24        INIT_FCALL                                               'substr_replace'
         25        SEND_VAL                                                 'stack'
         26        SEND_VAL                                                 'ge'
         27        SEND_VAL                                                 -2
         28        SEND_VAL                                                 2
         29        DO_ICALL                                         $6      
         30        CONCAT                                           ~7      $6, '%0A'
         31        ECHO                                                     ~7
    7    32        INIT_FCALL                                               'substr_replace'
         33        SEND_VAL                                                 'stack'
         34        SEND_VAL                                                 'bri'
         35        SEND_VAL                                                 0
         36        SEND_VAL                                                 3
         37        DO_ICALL                                         $8      
         38        CONCAT                                           ~9      $8, '%0A'
         39        ECHO                                                     ~9
    8    40        INIT_FCALL                                               'substr_replace'
         41        SEND_VAL                                                 'stack'
         42        SEND_VAL                                                 'hre'
         43        SEND_VAL                                                 1
         44        SEND_VAL                                                 -1
         45        DO_ICALL                                         $10     
         46        CONCAT                                           ~11     $10, '%0A'
         47        ECHO                                                     ~11
    9    48        INIT_FCALL                                               'substr_replace'
         49        SEND_VAL                                                 'stack'
         50        SEND_VAL                                                 'hre'
         51        SEND_VAL                                                 -4
         52        SEND_VAL                                                 -1
         53        DO_ICALL                                         $12     
         54        CONCAT                                           ~13     $12, '%0A'
         55        ECHO                                                     ~13
   10    56        INIT_FCALL                                               'substr_replace'
         57        SEND_VAL                                                 'stack'
         58        SEND_VAL                                                 'y'
         59        SEND_VAL                                                 3
         60        SEND_VAL                                                 0
         61        DO_ICALL                                         $14     
         62        CONCAT                                           ~15     $14, '%0A'
         63        ECHO                                                     ~15
   11    64        INIT_FCALL                                               'substr_replace'
         65        SEND_VAL                                                 'stack'
         66        SEND_VAL                                                 'y'
         67        SEND_VAL                                                 3
         68        DO_ICALL                                         $16     
         69        CONCAT                                           ~17     $16, '%0A'
         70        ECHO                                                     ~17
   12    71        INIT_FCALL                                               'substr_replace'
         72        SEND_VAL                                                 'voil%C3%A0'
         73        SEND_VAL                                                 'ci'
         74        SEND_VAL                                                 -2
         75        DO_ICALL                                         $18     
         76        CONCAT                                           ~19     $18, '%0A'
         77        ECHO                                                     ~19
   13    78        INIT_FCALL                                               'substr_replace'
         79        SEND_VAL                                                 'voil%C3%A0'
         80        SEND_VAL                                                 'ci'
         81        SEND_VAL                                                 -3
         82        DO_ICALL                                         $20     
         83        CONCAT                                           ~21     $20, '%0A'
         84        ECHO                                                     ~21
   14    85        INIT_FCALL                                               'substr_replace'
         86        SEND_VAL                                                 's%C3%BBret%C3%A9'
         87        SEND_VAL                                                 ''
         88        SEND_VAL                                                 4
         89        DO_ICALL                                         $22     
         90        CONCAT                                           ~23     $22, '%0A'
         91        ECHO                                                     ~23
         92      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.54 ms | 1015 KiB | 14 Q