Function definition with returning some value - PHP


############################

PHP Code

###################
########

<?php 
       // function definition with returning some value 
function sum($a,$b)  
{    
 $sum = $a + $b; 
 return $sum; 
function minus($a,$b) 
{   
$minus = $a - $b; 
return $minus; 
// function definition with returning some value 
// use of return function as a variable 
echo "Sum of 2 and 3 is : ".sum(2,3); 
// use of return function as a variable 
// function definition with returning some value 
?>
############################
Output of the Code
############################

Sum of 2 and 3 is : 5

Comments

Popular posts from this blog

Page Unload Show Notification to user

Function Oriented File Upload PHP

Upload File Using PHP - Example For Image