News Feed
Sections




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

Michael Kimsal's Blog:
Bizarre PHP behaviour
February 16, 2006 @ 14:40:59

In a new post on his blog today, Michael Kimsal looks at an abnormality that he's disocvered with constants in PHP.

Chalk this up as par for the course in the world of PHP, but it doesn't behave as documented. I noticed today that @ work someone is creating database connections, then define()ing the result into a constant. I presumed this was failing silently and because we were generally connecting to only one database (or so I thought initially) that it was simply using the last open connection and still working.

This does *not* throw an error, but does in fact work. Even going back to PHP 4.3.2 (earliest I've checked). This flies in the face of my understanding of constants for years - well, since 1998 (perhaps earlier) or so.

the issue - that a resource can be assigned to a constant - seems to contradict what's listed in the manual, and he asks later if there are others out there that have seen this same issue...

0 comments voice your opinion now!
bizarre behavior assign resource to constant bizarre behavior assign resource to constant


blog comments powered by Disqus

Similar Posts

Joshua Thijssen: Introducing the REST cookbook

PHPMaster.com: REST - Can You do More than Spell It? Part 2

Gennady Feldman's Blog: PHP Getting Started Videos and resources

PHPMaster.com: Under the Hood of Yii's Component Architecture, Part 3

Hasin Hayder's Blog: FeedPHP is going to be the largest PHP News Source


Community Events





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


unittest framework tips install update podcast api community zendserver symfony laravel release interview introduction opinion deployment language library package series

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