Skip to content

Instantly share code, notes, and snippets.

@berkes
Created October 29, 2012 13:46
Show Gist options
  • Save berkes/3973638 to your computer and use it in GitHub Desktop.
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.
<?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