|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-06-03 18:56 UTC] teo8976 at gmail dot com
Description: ------------ --- From manual page: http://www.php.net/functions.arguments --- Where it says: """ By default, function arguments are passed by value (so that if the value of the argument within the function is changed, it does not get changed outside of the function). """ it should say that an exception to this are objects, which are passed by reference. For comparison, the documentation for the assignment operator does specify that: http://docs.php.net/manual/en/language.operators.assignment.php """ Note that the assignment copies the original variable to the new one (assignment by value), [...] An exception to the usual assignment by value behaviour within PHP occurs with objects, which are assigned by reference """ So, the documentation for function arguments should be equally clear and explicit. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 05:00:01 2025 UTC |
> it should say that an exception to this are objects, which are > passed by reference. Note, though, that this would still be misleading. Consider function foo($object) { $object = null; } vs. function foo(&$object) { $object = null; } Only the latter has an effect which can be observed outside the function; see <https://3v4l.org/04vX5>.