note 35328 added to functions.arguments

From: Date: Wed, 27 Aug 2003 21:02:54 +0000
Subject: note 35328 added to functions.arguments
Groups: php.notes 
Request: Send a blank email to php-notes+get-55189@lists.php.net to get a copy of this message
Should note that '', an empty string, is not a null value. I have a function function doit($arg1,$arg2=1) { return $arg1 * $arg2; } $me = doit(234,$_COOKIE[something]); where arg2 is usually pulled from a cookie. if the cookie is not set, an empty string is passed, not a null value, resulting in the default value not being used inside the function. watch out! ---- Manual Page -- http://www.php.net/manual/en/functions.arguments.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35328 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35328&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35328&report=yes

« previous php.notes (#55189) next »