PHP special Characters

I have created a variable from a query;
$limit = "$".$extra['item_options']['accessories_value'] + $extra['item_options']['bike_value'].'<br />';

No matter what I try, I can't seem to get the Dollar sign ($) to print out when the variable is echoed.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
Then that line isn't the problem.  I have lots of code like that that prints '$' just fine.  Something else is removing it.  Do the other items print as they should?  You might try putting the addition part in parenthesis or better yet, do it before that line and assign it to a simple variable.  Doing operations in the middle of string doesn't always work.
$valuesum = $extra['item_options']['accessories_value'] + $extra['item_options']['bike_value'];
$limit = "$".$valuesum.'<br />';

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
Try wrapping the dollar sign in single quotes.
<?php // demo/temp_rgranlund.php


echo 'Here is the Dollar Sign you wanted: $';

Open in new window

Yohan CourbeIT ManagerCommented:
PHP interpolates variables only with double quote,  as Ray says, use simple quotes. I even suggest you to use sprintf for a proper formatting:

echo '$'.$amount; // output: $ 100
echo sprintf("$ %.02f", $amount); // output: $ 100.00

rgranlundAuthor Commented:
I tried all of the solutions and the one Dave suggested worked for me.  I think it has something to do with my CMS stipping certain characters at certain times.  I'm not sure.  I got it fixed and that is what matters.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.