note 73338 deleted from functions.arguments by cmb
| From: | cmb@php.net | Date: | Sun, 10 Nov 2019 13:20:21 +0000 |
| Subject: | note 73338 deleted from functions.arguments by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213028@lists.php.net to get a copy of this message | ||
Note Submitter: pdenny at magmic dot com
----
Note that constants can also be used as default argument values
so the following code:
define('TEST_CONSTANT','Works!');
function testThis($var=TEST_CONSTANT) {
echo "Passing constants as default values $var";
}
testThis();
will produce :
Passing constants as default values Works!
(I tried this in both PHP 4 and 5)