Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-21-2003, 08:29 PM   PM User | #1
Goober
New Coder

 
Join Date: Aug 2003
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Goober is an unknown quantity at this point
Printing Variables

how do you print variable names rather then the content the variable contains?
Goober is offline   Reply With Quote
Old 12-21-2003, 09:39 PM   PM User | #2
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
PHP Code:
<?php
$str 
"this is inside the variable";

echo 
$str.' $str';
?>
If you have a variable inside single quotes, it won't parse (if that's the right word)

echo "$str";

will show "This is inside the variable"

echo '$str';

will show $str
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 12-22-2003, 03:23 PM   PM User | #3
me'
Senior Coder

 
Join Date: Nov 2002
Location: Warwickshire, England
Posts: 1,229
Thanks: 0
Thanked 0 Times in 0 Posts
me' is an unknown quantity at this point
If you don't know the variable name (for example, you have a an array and are looping through it), it's impossible, but it's probably solvable another way. If Nightfire's method didn't solve your problems, post some code.
__________________
David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!
me' is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:27 AM.


Advertisement
Log in to turn off these ads.