You are here: Re: Cannot use "-" in variable names? « PHP Programming Language « IT news, forums, messages
Re: Cannot use "-" in variable names?

Posted by Justin Koivisto on 12/09/05 21:33

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

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация