3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "We have received ##AMOUNT## ##CURRENCY## for your OrderID n. ##ORDER_ID##"; $AMOUNT = 123; $CURRENCY = 'GBP'; $ORDER_ID = 20123; $find = ['##AMOUNT##','##CURRENCY##','##ORDER_ID##']; $replace = compact('AMOUNT', 'CURRENCY', 'ORDER_ID'); echo str_replace($find, $replace, $str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1E2Mm
function name:  (null)
number of ops:  18
compiled vars:  !0 = $str, !1 = $AMOUNT, !2 = $CURRENCY, !3 = $ORDER_ID, !4 = $find, !5 = $replace
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   ASSIGN                                                   !0, 'We+have+received+%23%23AMOUNT%23%23+%23%23CURRENCY%23%23+for+your+OrderID+n.+%23%23ORDER_ID%23%23'
   4     1        ASSIGN                                                   !1, 123
   5     2        ASSIGN                                                   !2, 'GBP'
   6     3        ASSIGN                                                   !3, 20123
   8     4        ASSIGN                                                   !4, <array>
   9     5        INIT_FCALL                                               'compact'
         6        SEND_VAL                                                 'AMOUNT'
         7        SEND_VAL                                                 'CURRENCY'
         8        SEND_VAL                                                 'ORDER_ID'
         9        DO_ICALL                                         $11     
        10        ASSIGN                                                   !5, $11
  11    11        INIT_FCALL                                               'str_replace'
        12        SEND_VAR                                                 !4
        13        SEND_VAR                                                 !5
        14        SEND_VAR                                                 !0
        15        DO_ICALL                                         $13     
        16        ECHO                                                     $13
        17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
13.58 ms | 410 KiB | 7 Q