young Mon May 31 04:32:15 2004 EDT
Modified files: /phpdoc/en/language functions.xml Log: Cosmetic changes: coding styles, paragraphs http://cvs.php.net/diff.php/phpdoc/en/language/functions.xml?r1=1.48&r2=1.49&ty=u Index: phpdoc/en/language/functions.xml diff -u phpdoc/en/language/functions.xml:1.48 phpdoc/en/language/functions.xml:1.49 --- phpdoc/en/language/functions.xml:1.48 Mon May 31 04:03:30 2004 +++ phpdoc/en/language/functions.xml Mon May 31 04:32:15 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.48 $ --> +<!-- $Revision: 1.49 $ --> <chapter id="language.functions"> <title>Functions</title> @@ -15,7 +15,7 @@ <programlisting role="php"> <![CDATA[ <?php -function foo ($arg_1, $arg_2, /* ..., */ $arg_n) +function foo($arg_1, $arg_2, /* ..., */ $arg_n) { echo "Example function.\n"; return $retval; @@ -66,7 +66,7 @@ bar(); if ($makefoo) { - function foo () + function foo() { echo "I don't exist until program execution reaches me.\n"; } @@ -228,12 +228,12 @@ <programlisting role="php"> <![CDATA[ <?php -function makecoffee ($type = "cappuccino") +function makecoffee($type = "cappuccino") { return "Making a cup of $type.\n"; } -echo makecoffee (); -echo makecoffee ("espresso"); +echo makecoffee(); +echo makecoffee("espresso"); ?> ]]> </programlisting> @@ -250,20 +250,22 @@ </screen> </para> <para> - Also PHP allows you to use arrays and special type NULL as - default values, for example: + Also PHP allows you to use arrays and special type NULL as + default values, for example: + </para> + <para> <example> <title>Using non-scalar types as default values</title> <programlisting role="php"> <![CDATA[ <?php -function makecoffee ($types = array("cappuccino"), $coffeeMaker = NULL) +function makecoffee($types = array("cappuccino"), $coffeeMaker = NULL) { $device = is_null($coffeeMaker) ? "hands" : $coffeeMaker; return "Making a cup of ".join(", ", $types)." with $device.\n"; } -echo makecoffee (); -echo makecoffee (array("cappuccino", "lavazza"), "teapot"); +echo makecoffee(); +echo makecoffee(array("cappuccino", "lavazza"), "teapot"); ?> ]]> </programlisting> @@ -285,12 +287,12 @@ <programlisting role="php"> <![CDATA[ <?php -function makeyogurt ($type = "acidophilus", $flavour) +function makeyogurt($type = "acidophilus", $flavour) { return "Making a bowl of $type $flavour.\n"; } -echo makeyogurt ("raspberry"); // won't work as expected +echo makeyogurt("raspberry"); // won't work as expected ?> ]]> </programlisting> @@ -316,12 +318,12 @@ <programlisting role="php"> <![CDATA[ <?php -function makeyogurt ($flavour, $type = "acidophilus") +function makeyogurt($flavour, $type = "acidophilus") { return "Making a bowl of $type $flavour.\n"; } -echo makeyogurt ("raspberry"); // works as expected +echo makeyogurt("raspberry"); // works as expected ?> ]]> </programlisting> @@ -376,11 +378,11 @@ <programlisting role="php"> <![CDATA[ <?php -function square ($num) +function square($num) { return $num * $num; } -echo square (4); // outputs '16'. +echo square(4); // outputs '16'. ?> ]]> </programlisting>