|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-04-30 03:36 UTC] andy at qabobala dot xapnet dot com
You cant use a reference with a default value (an optional function arg) when defining a function-- the parser will choke on this.
function ($somearg, &$object_ref = 0) {
if($object_ref == 0) {
...
}
else { ... }
}
Maybe this fails because php needs a predefined NULL - which is a reference to the NULL object.
later...
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 22 22:00:01 2025 UTC |
I need take argument-reference, but not obligatory. I write: --------------------- function foo($arg = '') { ... } foo(&$zz); // or foo() --------------------- and have warning: Call-time pass-by-reference has been deprecated... in documentation wrote: ~~~~~~~~~~~~~~~~~~~~~~~ Whether to enable the ability to force arguments to be passed by reference at function call time. This method is deprecated and is likely to be unsupported in future versions of PHP/Zend. ~~~~~~~~~~~~~~~~~~~~~~ And how I can now realize not obligatory argument-reference?