<html>
<! FunctionByValue.php                                        >
<! Chapter 7, Oracle Database XE PHP Web Programming          >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This script demonstrates defining a single parameter       >
<! function that accepts a variable by value.                 >
<head>
<title>
  Chapter 7 : FunctionByValue.php
</title>
</head>
<body>
<?php
  // Declare variable.
  $var = "Initial";

  // Print actual parameter value before function.
  print "Before function \$var [".$var."]<br>";

  // Call the user-defined function.
  print_string($var);

  // Print actual parameter value after function.
  print "After function \$var [".$var."]";

  // Define function that prints an input parameter as a string.
  function print_string($var)
  {
    // Print the local variable with a text literal.
    $var = "Updated";

    // Print actual parameter value.
    print "Inside function \$var [".$var."]<br>";
  }
?>
</body>
</html>
