I think you've missed a fundamental step - that is, returning the result of the calculation.
I.e I think you'll find the following amenable to your wishes.
<?php
function add ($first, $second)
{
$result = $first + $second;
return $result ;
}
echo add(4,5);
$answer = add(4,5);
echo $answer;
?>