Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > ebb1914cf182a88528b4547490db1dd8 > files > 1575

kdewebdev-quanta-doc-3.5.9-2mdv2008.1.x86_64.rpm

<HTML
><HEAD
><TITLE
>Functions</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="manual.html"><LINK
REL="UP"
TITLE="Language Reference"
HREF="langref.html"><LINK
REL="PREVIOUS"
TITLE="include"
HREF="function.include.html"><LINK
REL="NEXT"
TITLE="Function arguments"
HREF="functions.arguments.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.include.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="functions.arguments.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="functions"
>Chapter 12. Functions</A
></H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="functions.html#functions.user-defined"
>User-defined functions</A
></DT
><DT
><A
HREF="functions.arguments.html"
>Function arguments</A
></DT
><DT
><A
HREF="functions.returning-values.html"
>Returning values</A
></DT
><DT
><A
HREF="functions.old-syntax.html"
><TT
CLASS="literal"
>old_function</TT
></A
></DT
><DT
><A
HREF="functions.variable-functions.html"
>Variable functions</A
></DT
></DL
></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="functions.user-defined"
>User-defined functions</A
></H1
><P
>&#13;    A function may be defined using syntax such as the following:
 
    <DIV
CLASS="informalexample"
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>  1&nbsp;
  2&nbsp;function foo ($arg_1, $arg_2, ..., $arg_n) {
  3&nbsp;    echo "Example function.\n";
  4&nbsp;    return $retval;
  5&nbsp;}
  6&nbsp;     </PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
   </P
><P
>&#13;    Any valid PHP code may appear inside a function, even other
    functions and <A
HREF="oop.html#keyword.class"
>class</A
>
    definitions.
   </P
><P
>&#13;    In PHP3, functions must be defined before they are referenced. No
    such requirement exists in PHP4.
   </P
><P
>&#13;    PHP does not support function overloading, nor is it possible to
    undefine or redefine previously-declared functions.
   </P
><P
>&#13;    PHP3 does not support variable numbers of arguments to functions,
    although default arguments are supported (see <A
HREF="functions.arguments.html#functions.arguments.default"
>Default argument
    values</A
> for more information). PHP4 supports both: see <A
HREF="functions.arguments.html#functions.variable-arg-list"
>Variable-length argument
    lists</A
> and the function references for
    <A
HREF="function.func-num-args.html"
><B
CLASS="function"
>func_num_args()</B
></A
>,
    <A
HREF="function.func-get-arg.html"
><B
CLASS="function"
>func_get_arg()</B
></A
>, and
    <A
HREF="function.func-get-args.html"
><B
CLASS="function"
>func_get_args()</B
></A
> for more information.
   </P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.include.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="manual.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="functions.arguments.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.include.html"
><B
CLASS="function"
>include()</B
></A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="langref.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Function arguments</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>