Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 27th, 2004, 07:56 PM
Authorized User
 
Join Date: Aug 2003
Location: Coeur d\'Alene, ID, USA.
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Tachyon
Default using echo command to display "$"

This is probably a pretty easy question. When you are using the echo command to display text in a browser window it automatically interprets $ as an indicator of a variable. How do you get it to display "$" in the browser window? How do you override that automatic interpreting?

__________________
An overworked Web Developer who\'s expected to know everything yet given time to study nothing.
Reply With Quote
  #2 (permalink)  
Old February 27th, 2004, 08:09 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Use a backslash to escape the dollar sign like you would for quotes or other special characters.

echo "\$10.00";

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
Reply With Quote
  #3 (permalink)  
Old February 27th, 2004, 09:03 PM
Authorized User
 
Join Date: Aug 2003
Location: Coeur d\'Alene, ID, USA.
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Tachyon
Default

Thanks! I was hoping I wouldn't have to pour through online searches. :)

Reply With Quote
  #4 (permalink)  
Old March 1st, 2004, 09:54 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Alternatively, use a single-quoted string.

echo '$10.00';

PHP does not perform variable substitutions in single-quoted strings.

http://www.php.net/types.string


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
search data echo urbanaccess Access 7 January 23rd, 2007 10:54 AM
I need a echo wizard Anne1 PHP How-To 1 December 16th, 2006 04:20 AM
echo "\n" problem jun99 PHP How-To 4 November 29th, 2005 01:01 PM
echo "\n" problem jun99 Beginning PHP 0 November 27th, 2005 05:12 PM
new need help displaying echo $SESSION['authuser'] skafreak121 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 11 June 13th, 2005 01:06 AM



All times are GMT -4. The time now is 04:26 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.