FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


$$ in PHP





badai
i was learning php here

http://www.zend.com/zend/tut/feedback.php

it said "$$" is a PHP construction that gives the value of the variable name in the variable.

can someone explain to me what it means, like does it change the variable name or what?
yjwong
Some example for you:
Code:
<?php
$varname = "hello";
$$varname = "This is a variable named hello";
echo $hello; //Will output "This is a variable named hello"
?>


Basically it is just a variable as a variable name.
$$varname in the above example will be $hello.
badai
variable has a value

$$variable will make that value to become a variable itself and can store a value, and we can call it $value

is that correct?
yjwong
Yes, you're right there.
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.