Abscissa Tech Home Design Coding Media Server
Tutorials Courses Forums Resources
  Home
 
  Member Options
    Sign Up
  Log In
 
  Tools
    PowerHTML
    Teacher's Lounge
  References
  HTML
  PHP
  CSS
 
  Search
 
 
    Legalese
    Contact Us
    Privacy Policy
    About Abscissa

Chapter 12. Functions

User-defined functions

A function may be defined using syntax such as the following:

  1 
  2 function foo ($arg_1, $arg_2, ..., $arg_n) {
  3     echo "Example function.\n";
  4     return $retval;
  5 }
  6      

Any valid PHP code may appear inside a function, even other functions and class definitions.

In PHP3, functions must be defined before they are referenced. No such requirement exists in PHP4.

PHP does not support function overloading, nor is it possible to undefine or redefine previously-declared functions.

PHP3 does not support variable numbers of arguments to functions, although default arguments are supported (see Default argument values for more information). PHP4 supports both: see Variable-length argument lists and the function references for func_num_args(), func_get_arg(), and func_get_args() for more information.

This PHP manual is Copyright © 1997, 1998, 1999, 2000 the PHP Documentation Group. It has been licensed under the GPL. Permission granted for display on the Abscissa Tech web site on March 9, 2000. The most recent PHP documentation is available at http://www.php.net/.