npsari Posted February 16, 2020 Share Posted February 16, 2020 Hi everyone, i have a problem, look at this small PHP code $currency_symbol = '£'; \\\ Thats £ print "Price: $currency_symbol5"; The item price is 5 pounds, but because the 5 is attached, the code thinks the string name is $currency_symbol5 It does not work, to solve this, i put a space between them, like this... $currency_symbol = '£'; \\\ Thats £ print "Price: $currency_symbol 5"; But it looks funny on my website, it looks like this £ 5 How to solve this, thank you in advance Quote Link to comment https://forums.phpfreaks.com/topic/310046-string-paradox/ Share on other sites More sharing options...
Barand Posted February 16, 2020 Share Posted February 16, 2020 Use curly braces $currency_symbol = '£'; \\\ Thats £ print "Price: {$currency_symbol}5"; Quote Link to comment https://forums.phpfreaks.com/topic/310046-string-paradox/#findComment-1574339 Share on other sites More sharing options...
npsari Posted February 16, 2020 Author Share Posted February 16, 2020 Oh, cool, it worked, thank you Quote Link to comment https://forums.phpfreaks.com/topic/310046-string-paradox/#findComment-1574340 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.