kevincro Posted October 28, 2008 Share Posted October 28, 2008 I've been trying to use the $ sign within php code for its literal meaning. However, I can't figure out how to keep PHP from trying to use it as a variable. I've tried several things with to no avail. Link to comment https://forums.phpfreaks.com/topic/130453-using-the-sign/ Share on other sites More sharing options...
prexep Posted October 28, 2008 Share Posted October 28, 2008 Try <?php print '$variable'; //$variable ?> Link to comment https://forums.phpfreaks.com/topic/130453-using-the-sign/#findComment-676728 Share on other sites More sharing options...
Andy-H Posted October 28, 2008 Share Posted October 28, 2008 Are you trying to echo it? If you add it to a string it will work. $somevalue = 1000000; echo "$" . number_format($somevalue); //$1,000,000 Link to comment https://forums.phpfreaks.com/topic/130453-using-the-sign/#findComment-676729 Share on other sites More sharing options...
rhodesa Posted October 28, 2008 Share Posted October 28, 2008 either use single quotes, and php won't try to evaluate it, or escape it: echo "this is a \$sign"; Link to comment https://forums.phpfreaks.com/topic/130453-using-the-sign/#findComment-676734 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.