View Single Post
Old 11-25-2003, 01:33 PM   #4 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
PHP Code:
<?
/*
 * global variables.
 */
$x 5;
function 
foo()
{
  global 
$x;
  echo 
$x."\n";
}
foo(); // prints 5

/*
 * default values
 */
function bar($y "BAR")
{
  echo 
$y."\n";
}
bar(); // prints 'BAR'

/*
 * passing by reference
 */
function ref(&$z)
{
  echo 
$z."\n";
}  
$z "dude";
ref($z); // prints "dude" without making a copy of the string

/*
 * function pointers
 */
function asdf()
{
  echo 
"hi\n";
}
$fx "asdf";
$
$fx(); // prints "hi"
?>
joe_bruin is offline   Reply With Quote