note 112743 added to functions.arguments
| From: | post at auge8472 dot de | Date: | Thu, 18 Jul 2013 20:48:49 +0000 |
| Subject: | note 112743 added to functions.arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195668@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.199
Probable Submitter: 92.229.76.129
----
Manual Page -- http://php.net/manual/en/functions.arguments.php
Edit -- https://master.php.net/note/edit/112743
Del: integrated -- https://master.php.net/note/delete/112743/integrated
Del: useless -- https://master.php.net/note/delete/112743/useless
Del: bad code -- https://master.php.net/note/delete/112743/bad+code
Del: spam -- https://master.php.net/note/delete/112743/spam
Del: non-english -- https://master.php.net/note/delete/112743/non-english
Del: in docs -- https://master.php.net/note/delete/112743/in+docs
Del: other reasons-- https://master.php.net/note/delete/112743
Reject -- https://master.php.net/note/reject/112743
Search -- https://master.php.net/manage/user-notes.php