Create a simple PHP Function that Return values

Submitted by:David Villa

Date added:04 February, 2012

Category:PHP

An example PHP function return a value, use the return statement.

Tags: php function

Code Snippet:

<?php
function add($x,$y)
{
$total=$x+$y;
return $total;
}

echo "1 + 16 = " . add(1,16);
?>
 
 

Comments