3v4l.org

run code in 500+ 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:  14
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        FRAMELESS_ICALL_2                strpos              ~3      !2, !0
          4        FRAMELESS_ICALL_3                substr              ~4      !2, 0
          5        OP_DATA                                                      ~3
    8     6        CONCAT                                               ~5      ~4, !1
    9     7        FRAMELESS_ICALL_2                strpos              ~6      !2, !0
          8        STRLEN                                               ~7      !0
          9        ADD                                                  ~8      ~6, ~7
         10        FRAMELESS_ICALL_2                substr              ~9      !2, ~8
         11        CONCAT                                               ~10     ~5, ~9
         12      > RETURN                                                       ~10
   10    13*     > RETURN                                                       null

End of function str_replace_first

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
214.59 ms | 2232 KiB | 13 Q