3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a='I love you'; echo str_replace_first('z','ea',$a); function str_replace_first($thiss,$that,$where) { return substr($where,0,strpos($where,$thiss)). $that. substr($where,strpos($where,$thiss)+strlen($thiss)); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XHtfc
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'I+love+you'
    3     1        INIT_FCALL_BY_NAME                                       'str_replace_first'
          2        SEND_VAL_EX                                              'z'
          3        SEND_VAL_EX                                              'ea'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $2      
          6        ECHO                                                     $2
   10     7      > RETURN                                                   1

Function str_replace_first:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XHtfc
function name:  str_replace_first
number of ops:  26
compiled vars:  !0 = $thiss, !1 = $that, !2 = $where
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    7     3        INIT_FCALL                                               'substr'
          4        SEND_VAR                                                 !2
          5        SEND_VAL                                                 0
          6        INIT_FCALL                                               'strpos'
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                         $4      
    8    12        CONCAT                                           ~5      $4, !1
    9    13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !2
         15        INIT_FCALL                                               'strpos'
         16        SEND_VAR                                                 !2
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $6      
         19        STRLEN                                           ~7      !0
         20        ADD                                              ~8      $6, ~7
         21        SEND_VAL                                                 ~8
         22        DO_ICALL                                         $9      
         23        CONCAT                                           ~10     ~5, $9
         24      > RETURN                                                   ~10
   10    25*     > RETURN                                                   null

End of function str_replace_first

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.95 ms | 1396 KiB | 17 Q