News Feed
Sections




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

Hasin Hayder's Blog:
Did you know 'you can have cheese burger' could be a variable name?
October 24, 2007 @ 08:57:00

Hasin Hayder has a quick tip for users of SimpleXML - a handy way to access a node in an XML document that has unsupported characters in its name.

I was finding a way to refer that element as a SimpleXMLElement and found a nifty note in PHP Manual. It says if you have unsupported (unsupported in PHP Lexicon for a variable name) characters inside the name of a node, you can access it using a special pattern {'name'}.

In his example, he shows how a popular phrase ("i can have cheese burger") can be used as the variable name despite having spaces in it.

0 comments voice your opinion now!
variable name unsupported character special pattern variable name unsupported character special pattern


blog comments powered by Disqus

Similar Posts

Derick Rethans' Blog: Debugging Variables

Hasin Hayder's Blog: Did you know 'you can have cheese burger' could be a variable name?

Hasin Hayder's Blog: Did you know 'you can have cheese burger' could be a variable name?

Jim Plush's Blog: Followup on rethinking Zend Models with DDD - Framework code included

Brian Moon's Blog: Null vs. isset()


Community Events

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


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

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