|
Posted by Kim Andr Aker on 12/09/05 21:36
Justin Koivisto wrote:
> Kim André Akerø wrote:
> > ross wrote:
> >
> > > The following gives an error:
> > >
> > > <?php
> > > $super-man=100;
> > > ?>
> > >
> > > Parse error: parse error, unexpected '=' in /test.php on line 2
> > >
> > > I understand that the "-" sign is seen as an operator.
> >
> > Correct, the "-" sign is considered as a minus sign.
> >
> > > is there a way to get around this? I need to have "-" in variable
> > > names.
> >
> > Why?
> >
> > You can safely use "_" (underscore) instead. If you need to use it
> > in a query string or form field, use $_POST, $_GET or $_REQUEST.
>
> - characters in those arrays are replaced by _ automagically...
I wasn't aware of that. Then again, I've never had the need/use to have
a "-" in a variable (either in a form or as a query string).
--
Kim André Akerø
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Navigation:
[Reply to this message]
|