|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello fellow DevShedders,
I have a wee little script (only 109kb or so) that has a little problems. The script e-mails a quote for a price to the user. The only problem the script is having is within the e-mail. I am using a Windows system, so I'm using number_format for the dollar amount. I use a code something like this: echo "Your price is $".number_format($price, 2, ".", ",")." for you item."; The problem is that when this is appearing in the e-mails, it appears as follows: Your price is \$19.55 for your item. I've tried str_replace to get rid of the "\" character, but to no avail. Is there any way to ensure that the \ will not be automatically put in by PHP? I decided to give this issue to the experts... You! Sincerely, Confused blind monkey. |
|
#2
|
|||
|
|||
|
use \ before any symbols that have a actual use in php or anything of the sort.
|
|
#3
|
|||
|
|||
|
try using stripslashes($str);
![]() |
|
#4
|
|||
|
|||
|
I do use backslashes before symbols, but whether I do or not, PHP will include them in the e-mail body no matter what. I'll try the slash stripping function and see if that clears them. Thanks for the advice.
|
|
#5
|
|||
|
|||
|
Try:
echo 'Your price is $'.number_format($price, 2, ".", ",").' for you item.'; The single quotes make PHP treat $ as any other character, not a variable. |
|
#6
|
||||
|
||||
|
Quote:
So what is the actual code you're using, because that code you gave will not add a slash before the dollar sign. You must be doing something else to the string in order for the slash to appear. ---John Holmes... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > Dollar Sign issues |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|