Pass arguments by value in PHP

Description

The following code shows how to pass arguments by value.

Example


<?php/* ww  w  .jav a  2 s.c o  m*/

function calcSalesTax($price, $tax)
{
    $total = $price + ($price * $tax); 
    echo "Total cost: $total";
}

calcSalesTax(15.00, .075);

?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Language Basic »




PHP Introduction
PHP Operators
PHP Statements
Variable
PHP Function Create
Exception
PHP Class Definition