Ejemplo n.º 1
0
function say_hello()
{
    echo "Hello World! <br />";
}
say_hello();
function say_hello2($word)
{
    echo "Hello {$word}! <br />";
}
say_hello2("World");
say_hello2("Universe");
$name = "John Doe";
say_hello2($name);
//$target is an internal variable that is only used within
//the function
function say_hello3($greeting, $target, $punct)
{
    echo $greeting . ", " . $target . $punct . "<br />";
}
say_hello3("Greetings", $name, "!");
?>
<br />
<?php 
function addition($val1, $val2)
{
    $sum = $val1 + $val2;
}
echo addition(3, 4);
?>
</body>
</html>
</pre>
</div>
</div>
<br><br>
<table width="500" border="0" align="center" cellpadding="1" cellspacing="1" class="tbl_border">
  <tr>
    <td><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="tbl_gray_wborder">
        <tr>
          <td class="txt14b_black">
            <p align="center"><span class="txt16b_blue">Sample Output: </span><br>
              <br>
	<?php 
$name = "Eric Li";
function say_hello3($greeting, $target, $punct)
{
    echo $greeting . ", " . $target . $punct . "<br />";
}
say_hello3("HI", $name, "!");
?>
	<br />
	<br>
              <br>
          </p></td>
        </tr>
    </table></td>
  </tr>
</table>

</body>
</html>