Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

new to PHP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

new to PHP

Postby qadeerbk » Wed Oct 02, 2002 4:26 am

I am new to PHP, and I just want to ask that some time I see the PHP coding( the codes, available on net) in whoch the variable name contains 2 doller sign.
like

return $$x;

is it just by mistake or it has special effect ?

Thank u very much
qadeerbk
New php-forum User
New php-forum User
 
Posts: 7
Joined: Sun Sep 29, 2002 9:36 am

Postby Jay » Wed Oct 02, 2002 8:38 am

It means a variable variable! Sounds complicated but it's quite simple!

Say you have two variables:
$apple = 5;
$orange = 10;

And the user selects a $fruit variable, so $fruit = "apple", then $$fruit = 5. This is because $fruit = "apple", and then you've got another $ sign, so it's $apple which we know to be 5!
Jay
 


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 5 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.