I have the following (summarised) code
define pauls_code($a, $b)
{
$c = $a + $b;
echo $a;
echo $b;
}
pauls_code(1,2);
echo $c;  //  how do I get this to print outside of the function?   I have tried everything. I am hoping to see 123
I have the following (summarised) code
define pauls_code($a, $b)
{
$c = $a + $b;
echo $a;
echo $b;
}
pauls_code(1,2);
echo $c;  //  how do I get this to print outside of the function?   I have tried everything. I am hoping to see 123
 
    
     
    
    make your function like this and return the $c
function pauls_code($a, $b){
$c = $a + $b;
return $c;
}
echo pauls_code(1,2);
 
    
    To declare a function in php you simply put function pauls_code($param1, $param2) not define
You can not access $c outside of the function, read more about scope: http://php.net/manual/en/language.variables.scope.php