Heh, lucky me I was just looking into that earlier today.

http://us.php.net/manual/en/language.types.string.php

Around the "Simple Syntax" area.

-Logan

-----Original Message-----
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 25, 2007 9:42 AM
To: Man-wai Chang
Cc: php-general@lists.php.net
Subject: Re: [PHP] ${}

On Wed, 2007-04-25 at 21:23 +0800, Man-wai Chang wrote:
> where can I find the documentation about this "symbol"?

Maybe in the documentation? A cursory glance from me though didn't turn
anything up. Either way I can inform you of the purpose...

The following two expression have the same result:

    $foo = 5;
    ${'foo'} = 5;

The difference being that the code between { and } is first evaluated to
determine the name of the variable. $foo is preferred and faster but
there may be the odd time when you find doing something like the
following useful:

    ${'foo_'.$i} = $someValue;

So let's imagine $i = 3, then a variable called $foo_3 has been created
and can even be accessed as $foo_3.

If you are familiar with variable variables then you may be aware that
the above can also be achieved as follows:

    $name = 'foo_'.$i;
    $$name = $someValue;

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to