note 32616 added to functions.arguments

From: Date: Tue, 03 Jun 2003 07:06:39 +0000
Subject: note 32616 added to functions.arguments
Groups: php.notes 
Request: Send a blank email to php-notes+get-49598@lists.php.net to get a copy of this message
A tiny clarification on the notes of "keeper at odi dot com dot br", et. al. Functions explicitly prototyped with formal parameters passed by reference can't have default values. However, functions prototyped to assign default values to formal parameters may be passed references. For example, this is a parse error: function foo(&$bar = null) { // formal parameters as references can't have default values $bar = 242; } While this is perfectly legal (and probably what you want, mostly): function foo($bar = null) { $bar = 242; } foo(); // valid call, no warnings about missing args foo(&$x); // valid call, post $x == 242 ---- Manual Page -- http://www.php.net/manual/en/functions.arguments.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32616 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32616&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32616&report=yes

« previous php.notes (#49598) next »