News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

David Otton's Blog:
Stupid PHP Tricks Illegal Variable Names
August 22, 2008 @ 13:47:52

David Otton has shared another of his "stupid PHP tricks" on his blog today. This one looks at illegal variable names that don't match the "can't start with a number" rule the manual points out.

A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: '[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*'

Technically, you can get around this in two different ways - variable varaibles and the more complex notation with curly braces. He points to the compact function for proof that they're set.

0 comments voice your opinion now!
variable trick illegal name compact curlybrace


blog comments powered by Disqus

Similar Posts

Derick Rethans' Blog: Collecting Garbage: PHP's take on variables

Joshua Eichorn\'s Blog: ZActiveRecord can\'t work?

WaxJelly Blog: The easiest way to scrape details from a MySpace profile page with PHP

Till Klampaeckel's Blog: Zend Framework: Writing an IN-Clause with Zend_Db

Derick Rethans's Blog: HTML name attribute deprecated


Community Events

Don't see your event here?
Let us know!


security extension library voicesoftheelephpant opinion php7 framework language laravel list series api laravel5 podcast version introduction community release example interview

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework