Created
October 29, 2012 13:46
-
-
Save berkes/3973638 to your computer and use it in GitHub Desktop.
another WTF in PHP. Makes sense, technically, but as a use it makes no sense.
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
<?php | |
function foo($bar) { | |
var_dump($bar); | |
} | |
foo(array()); # => array(0) {} | |
## Works as expected. But now... | |
function foo(&$bar) { | |
var_dump($bar); | |
} | |
foo(array()); # PHP Fatal error: Only variables can be passed by reference in /home/ber/.../test.php on line X | |
# Yup. fail. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment