note 40065 added to functions

From: Date: Fri, 20 Feb 2004 15:10:03 +0000
Subject: note 40065 added to functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-65448@lists.php.net to get a copy of this message
Took me a while to figure this out. If you want a function to have a optional variable you just add = VALUE so it would look like this: <?php function foo($foo, $bar = "bar") { echo $foo.$bar; } echo foo("foo"); //gives: foobar echo foo("foo","bar2"); //gives foobar2 ?> ---- Manual Page -- http://www.php.net/manual/en/functions.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40065 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40065&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40065&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65448) next »