--- 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.

James
_____


James D. Keeline
http://www.Keeline.com  http://www.Keeline.com/articles
http://Stratemeyer.org  http://www.Keeline.com/TSCollection

http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Fall Semester Begins Sep 7 -- New Classes Start Every Few Weeks.


------------------------ 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/
 



Reply via email to