I want to do something like this.
function add($num1, $num2 = 1) {
return $num1 + $num2;
}
$bool = true; // Can be true or false
if($bool) {
add(5, 5);
} else {
add(5);
}
I was asking me, if it is possible to write this logic in one line like, without repeating the default value:
add(5, $bool ? 5 : USE_DEFAULT_PARAMETER);