Search This Blog

function with return in php

<?php

$num1=10;
$num2=5;

function add($num1,$num2)
{
return $num1+$num2;
}


function multi($num1,$num2)
{
return $num1*$num2;
}

echo 'add : '.add($num1,$num2).'<br>';

echo 'multiply : '.multi($num1,$num2).'<br>';

echo 'function in function : '.add(multi($num1,$num2),multi($num1,$num2)).'<br>';


?>

output :

add : 15
multiply : 50
function in function : 100

Share Links

Related Posts Plugin for WordPress, Blogger...