Basically, I have an html block that I want to repeat on the page, and html has a $ sign in it, and php considers this to be a variable, so $ 1 is considered as a variable, not a value and not displayed.
There are standard answers here, but no one works: PHP: how to get $ to print using echo
My next idea is to split the string into $ and echo into each part.
Here is the code that I tried echo and print.
foreach ($rows as $rowmk) { $s = $rowmk->longdescription; //$s = str_replace('$', '@', $s); $s = str_replace('$', '\$', $s); //echo "$s" . "<br>"; print $s; }
All help was appreciated.
OK, I decided to use the character code value for $
foreach ($rows as $rowmk) { $s = $rowmk->longdescription; $s = str_replace('$', '$', $s); echo $s . "<br>"; }
I decided that I should just post it anyway.
Thanks,
Mat
source share