note 112743 deleted from functions.arguments by cmb
| From: | cmb@php.net | Date: | Sun, 10 Nov 2019 12:55:53 +0000 |
| Subject: | note 112743 deleted from functions.arguments by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213013@lists.php.net to get a copy of this message | ||
Note Submitter: post at auge8472 dot de
----
I needed a way to decide between two possible values for one function parameter. I didn't want
to decide it before calling the function but wanted to do the constraint inside the function call.
$foo = 1;
$bar = 2;
function foobar($val) {
echo $val;
}
foobar(isset($foo) ? $foo : $bar);
// output: 1
$bar = 2;
function foobar($val) {
echo $val;
}
foobar(isset($foo) ? $foo : $bar);
// output: 2