> "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote:
> > > 1. If $id is a number I believe PHP will choke b/c I don't believe
> numbers
> > > can be used as variable names.
> >
> > Well, generally that is true.  If you try to assign a value directly to a
> > variable that is a number such as:
> >
> >  $1 = "Hello World";
> >
> > Then it won't work.  However, due to a somewhat quirky implementation you
> > can get arund this by doing:
> >
> >  $a=1;
> >  $$a = "Hello World";
>
> Sure enough, it works.  Rasmus, can we expect this behavior to exist in
> future releases of PHP?  I prefer to give variables a meaningful name, but
> since I spend a fair amount of time working with other people's code and
> clients who sometimes insist on things that aren't preferable, it would be
> nice to know.

Writing code that relies on this behaviour is a bad idea.  It is unlikely
to change in PHP 4, but who knows what will happen in the longer term...

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to