philip Sat Sep 28 23:40:40 2002 EDT Modified files: /phpdoc/en/chapters tutorial.xml Log: Moved tutorial.prototypes to about.prototypes Index: phpdoc/en/chapters/tutorial.xml diff -u phpdoc/en/chapters/tutorial.xml:1.9 phpdoc/en/chapters/tutorial.xml:1.10 --- phpdoc/en/chapters/tutorial.xml:1.9 Fri Sep 27 16:18:30 2002 +++ phpdoc/en/chapters/tutorial.xml Sat Sep 28 23:40:39 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <chapter id="tutorial"> <title>A simple tutorial</title> @@ -322,133 +322,6 @@ if the string <literal>MSIE</literal> was found or not. </para> </sect1> - - <sect1 id="tutorial.prototypes"> - <title>How to read a function definition (prototype)</title> - <para> - Each function is documented for quick reference, knowing how - to read and understand the manual will make using PHP - much easier. Rather than relying on examples or cut/paste, you want - to know how to read function definitions (prototypes). Let's begin: - </para> - <note> - <title> - Prerequisite: Basic understanding of <link linkend="language.types">types</link> - </title> - <para> - Although PHP is a loosly typed language, it's important to have - a basic understanding of <link linkend="language.types">types</link> as - they have important meaning. - </para> - </note> - <para> - Function definitions tell us what - type of value is <link linkend="functions.returning-values">returned</link>, - let's use the definition for <function>strlen</function> as our first example: - </para> - <para> - <screen role="html"> -strlen - -(PHP 3, PHP 4 >= 4.0.0) -strlen -- Get string length - -Description -int strlen ( string str ) - -Returns the length of string. - </screen> - </para> - <para> - <table> - <title>Explanation of a function definition</title> - <tgroup cols="2"> - <thead> - <row> - <entry>Part</entry> - <entry>Description</entry> - </row> - </thead> - <tbody> - <row> - <entry> - strlen - </entry> - <entry> - The function name. - </entry> - </row> - <row> - <entry> - (PHP 3, PHP 4 >= 4.0.0) - </entry> - <entry> - strlen() has been around in both all of PHP 3 and PHP 4 - </entry> - </row> - <row> - <entry> - int - </entry> - <entry> - Type of value this function returns, which is an - <link linkend="language.types.integer">integer</link> - (i.e. The length of a string is measured in numbers). - </entry> - </row> - <row> - <entry> - ( string str ) - </entry> - <entry> - The first (and in this case the only) parameter/argument for the - function strlen is named <parameter>str</parameter>, and it's a - <link linkend="language.types.string">string</link>. - </entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <para> - We could rewrite the above function definition in a generic way: - </para> - <para> - <screen role="html"> - returned type function name ( parameter type parameter name ) - </screen> - </para> - <para> - Many functions take on multiple parameters, such as <function>in_array</function>. - It's prototype is as follows: - </para> - <para> - <screen role="html"> - bool in_array ( mixed needle, array haystack [, bool strict]) - </screen> - </para> - <para> - What does this mean? in_array() returns a - <link linkend="language.types.boolean">boolean</link> value, &true; on - success (the <parameter>needle</parameter> was found in the - <parameter>haystack</parameter>) or &false; on failure (the - <parameter>needle</parameter> was not found in the - <parameter>haystack</parameter>). The first parameter is named - <parameter>needle</parameter> and it can be many different - <link linkend="language.types">types</link>, so we call it - "<emphasis>mixed</emphasis>". This mixed <parameter>needle</parameter> - (what we're looking for) can either be a scalar value (string, integer, - or <link linkend="language.types.float">float</link>), or an - <link linkend="language.types.array">array</link>. - <parameter>haystack</parameter> (the array we're searching in) is the - second parameter. The third <emphasis>optional</emphasis> parameter is - named <parameter>strict</parameter>. All optional parameters are seen - in <emphasis>[</emphasis> brackets <emphasis>]</emphasis>. The manual - states that the <parameter>strict</parameter> parameter defaults to - boolean &false;. See the manual page on each function for details on - how they work. - </para> - </sect1> <sect1 id="tutorial.forms"> <title>Dealing with Forms</title>
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php