Be glad that this doesn't work:
echo CalculateResult($order)[0];
Because if it did, you'd be executing CalculateResult() every time you use this statement, which is NOT what you want if the function returned 1000 results.
Instead, use references, and return only true/false:
function CalculateResult($input, &$aOutput)
{
if (fetch_from_database_or_whatever)
{
$aOutput = array('your','output','here');
return true;
}
else
{
$aOutput = array();
return false;
};
};
if (CalculateResult('bla', $aMyResults))
{
echo $aMyResults[0];
}
else
{
echo 'calculate failed';
};