News Feed
Sections




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

Johannes Schluter's Blog:
Do not use PHP references
January 11, 2010 @ 10:50:22

In a new post to his blog Johannes Schluter recommends that you don't use references in your applications, mostly because of some misconceptions about how they work.

Last year I spoke at eight conferences and attended a few more multiple times at most of them I found myself in discussions about references and PHP as many users seem to have wrong understandings about them. Before going to deep into the subject let's start with a quick reminder what references are and clear some confusion about objects which are "passed by reference."

He re-introduces referenced variables and scratches the surface about the confusion they can cause, not only on the user level but also in the internals of the language, and can lead to some unexpected results. He also mentions the "always passed by reference" idea that several PHPers have about PHP5 objects and why it's not entirely correct. He finishes off the post with a look at returning referenced parameters and how it can lead to bad application design.

0 comments voice your opinion now!
references avoid misconception


blog comments powered by Disqus

Similar Posts

Jani Hartikainen's Blog: Zend_Acl part 1: Misconceptions and simple ACLs

Johannes Schluter's Blog: Do not use PHP references

Rochak Chauhan's Blog: Top Ten Security Vulnerabilities in PHP Code

Davey Shafik's Blog: Avoiding EVAL()

Volker Dusch's Blog: References suck! - Let's fix MySqli prepared statements!


Community Events

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


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

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