I have the following snippet:
// Some post is made and I have access to it using Input::get('name_of_field');
if (Input::has('optionalField'))
{
$thisVariable = myMagicalFunction();
}
// more operation
// being performed
ultimateFunction($thisVariable);
return true;
As you can see, $thisVariable may sometimes not be set, and so the ultimateFunction($thisVariable) may sometimes return error saying the variable is undefined. I can of course use
if (isset($thisVariable)) ultimateFunction($thisVariable);
But is there a way to force pass the variable anyhow without checking if it is set? I will then check if it is set inside ultimateFunction.