note 77492 deleted from language.functions by nikic

From: Date: Wed, 30 Apr 2014 15:29:07 +0000
Subject: note 77492 deleted from language.functions by nikic
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-199381@lists.php.net to get a copy of this message
Note Submitter: email at fake dot com ---- You can set variable DEFAULT values for a function in the (). These will be over-written by any input values (or non values). <?php function default_values_test ($a = 123, $b = 456){ echo "a = ".$a."<br/>"; echo "b = ".$b."<br/>"; echo "<br/>"; } default_values_test(); // uses values set in 'header' default_values_test('overwritten', 987654321); // uses these values default_values_test($non_existent, "var A has to be overwritten."); // you can only use this for the last vars. ?> OUTPUT: ---------- a = 123 b = 456 a = overwritten b = 987654321 a = b = var A has to be overwritten.

« previous php.notes (#199381) next »