James Keeline wrote:
> --- sourabh kulkarni <[EMAIL PROTECTED]> wrote:
>
>
>> can anybody let me know what is $$ in php and where it is used?
>>
>> Thanks,
>> Sourabh
>>
>
> The $$ before a variable name indicates that it is a dynamic variable.
> Specifically, the actual name of the variable being referred to is the
> contents
> of another variable.
>
> It is sometimes easier to read if curly braces are used. For example,
>
> $$var
>
> is equivalent to
>
> ${$var}
>
> In terms of practical use, there are times when you don't know the name of a
> variable while programmin but want it to be set during runtime. A simple
> example of use is:
>
> $X = "banana";
> ${$X} = "ice cream";
> print ${$X}; // displays "ice cream"
>
> In this example, $X holds a word. The ${$X} or $$X takes the content of $X
> and
> uses it as a variable name which can be set or used in another expression such
> as print.
>
>
Now what's the difference between the above and this:
$X = "banana";
$X = "ice cream";
echo($X); // displays "ice cream"
--
Skylinux
Computer and Robotic Research
http://www.network-technologies.org
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~->
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/