Skip to main content

All Questions

5 votes
1 answer
1k views

Why does PHP allow passing a literal to a pass-by-reference parameter in one case but not others?

The function array_shift() takes one parameter by reference. Passing an array literal causes a fatal error: $ php -r 'var_export(array_shift(array("Test #0"));';echo Fatal error: Only ...
user3427070's user avatar
1 vote
3 answers
332 views

In PHP, when $foo = new Foo(), technically speaking, is $foo an object, or is $foo a reference?

Update: in http://php.net/manual/en/language.oop5.references.php it says: One of the key-points of PHP5 OOP that is often mentioned is that "objects are passed by references by default". ...
nonopolarity's user avatar