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);

preferences:
44.63 ms | 408 KiB | 5 Q