new to PHP

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 7
Joined: Sun Sep 29, 2002 9:36 am

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.

return $$x;

is it just by mistake or it has special effect ?

Thank u very much


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!

Post Reply