note 81139 deleted from function.constant by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 08:01:21 +0000 |
| Subject: | note 81139 deleted from function.constant by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196732@lists.php.net to get a copy of this message | ||
Note Submitter: Joachim Chmielewski
----
To use constants in functions additional its not neccessary to change the function call wherever you
need the constant in a function.
foo($var1);
to
foo($var1,$const);
More easy is to change the function definition and use a default value for a new variable that
contains the const value.
function foo($var1,$my_const=CONST_VALUE){
if($my_const==1) dosomething();
}
Now it`s not necessary to change the function call wherever you need the function.