#27. PHP Functions with Returning Value

 PHP Functions with Returning Value


Run Code:

<?php

// function ret($fname, $lname)

// {

// $a = "$fname $lname";

// return $a;

// }

// $name = ret("Aqib", "Saeed");

// echo "MR. $name";

//2.

function sum($math,$Comp,$Eng){
    $s = $math + $Comp + $Eng;
    return $s;
}
function percentage($st){
    $per = $st/3;
    echo $per . "%";
}
$total = sum(20,30,40);
percentage($total);
?>

Comments

Popular posts from this blog

#30. PHP Recursive Function