3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.23 ms | 1399 KiB | 17 Q