Created
July 4, 2011 11:58
-
-
Save giorgiosironi/1063267 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doSomethingRef(&$o) { | |
$o = null; | |
} | |
function doSomething($o) { | |
$o = null; | |
} | |
$object = new stdClass; | |
// passed by reference | |
doSomethingRef($object); // $object is now null | |
// passed by handler (usual case) | |
doSomething($object); // $object is still a stdClass | |
You're right, it wasn't thought as running code. :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's a little bit confusing, isn't it? Shouldn't it be more like: