philip Mon Jun 9 15:28:28 2003 EDT Modified files: /phpdoc/en/language control-structures.xml expressions.xml functions.xml oop.xml references.xml Log: Added <?php ?> tags.
Index: phpdoc/en/language/control-structures.xml diff -u phpdoc/en/language/control-structures.xml:1.76 phpdoc/en/language/control-structures.xml:1.77 --- phpdoc/en/language/control-structures.xml:1.76 Mon Jun 9 03:36:01 2003 +++ phpdoc/en/language/control-structures.xml Mon Jun 9 15:28:28 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.76 $ --> +<!-- $Revision: 1.77 $ --> <chapter id="control-structures"> <title>Control Structures</title> @@ -47,8 +47,10 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php if ($a > $b) print "a is bigger than b"; +?> ]]> </programlisting> </informalexample> @@ -65,10 +67,12 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php if ($a > $b) { print "a is bigger than b"; $b = $a; } +?> ]]> </programlisting> </informalexample> @@ -97,11 +101,13 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php if ($a > $b) { print "a is bigger than b"; } else { print "a is NOT bigger than b"; } +?> ]]> </programlisting> </informalexample> @@ -134,6 +140,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php if ($a > $b) { print "a is bigger than b"; } elseif ($a == $b) { @@ -141,6 +148,7 @@ } else { print "a is smaller than b"; } +?> ]]> </programlisting> </informalexample> @@ -201,6 +209,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php if ($a == 5): print "a equals 5"; print "..."; @@ -210,6 +219,7 @@ else: print "a is neither 5 nor 6"; endif; +?> ]]> </programlisting> </informalexample> @@ -267,6 +277,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php /* example 1 */ $i = 1; @@ -283,6 +294,7 @@ print $i; $i++; endwhile; +?> ]]> </programlisting> </informalexample> @@ -310,10 +322,12 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php $i = 0; do { print $i; } while ($i>0); +?> ]]> </programlisting> </informalexample> @@ -334,6 +348,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php do { if ($i < 5) { print "i is not big enough"; @@ -348,6 +363,7 @@ ...process i... } while(0); +?> ]]> </programlisting> </informalexample> @@ -406,6 +422,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php /* example 1 */ for ($i = 1; $i <= 10; $i++) { @@ -435,6 +452,7 @@ /* example 4 */ for ($i = 1; $i <= 10; print $i, $i++); +?> ]]> </programlisting> </informalexample> @@ -537,6 +555,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php $arr = array("one", "two", "three"); reset ($arr); while (list(, $value) = each ($arr)) { @@ -546,6 +565,7 @@ foreach ($arr as $value) { echo "Value: $value<br>\n"; } +?> ]]> </programlisting> </informalexample> @@ -553,6 +573,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php reset ($arr); while (list($key, $value) = each ($arr)) { echo "Key: $key; Value: $value<br>\n"; @@ -561,6 +582,7 @@ foreach ($arr as $key => $value) { echo "Key: $key; Value: $value<br>\n"; } +?> ]]> </programlisting> </informalexample> @@ -570,6 +592,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php /* foreach example 1: value only */ $a = array (1, 2, 3, 17); @@ -620,6 +643,7 @@ foreach (array(1, 2, 3, 4, 5) as $v) { print "$v\n"; } +?> ]]> </programlisting> </informalexample> @@ -643,6 +667,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php $arr = array ('one', 'two', 'three', 'four', 'stop', 'five'); while (list (, $val) = each ($arr)) { if ($val == 'stop') { @@ -666,6 +691,7 @@ break; } } +?> ]]> </programlisting> </informalexample> @@ -696,6 +722,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php while (list ($key, $value) = each ($arr)) { if (!($key % 2)) { // skip odd members continue; @@ -716,6 +743,7 @@ } echo "Neither does this.<br>\n"; } +?> ]]> </programlisting> </informalexample> @@ -749,6 +777,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php if ($i == 0) { print "i equals 0"; } elseif ($i == 1) { @@ -768,6 +797,7 @@ print "i equals 2"; break; } +?> ]]> </programlisting> </informalexample> @@ -789,6 +819,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php switch ($i) { case 0: print "i equals 0"; @@ -797,6 +828,7 @@ case 2: print "i equals 2"; } +?> ]]> </programlisting> </informalexample> @@ -824,6 +856,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php switch ($i) { case 0: case 1: @@ -833,6 +866,7 @@ case 3: print "i is 3"; } +?> ]]> </programlisting> </informalexample> @@ -844,6 +878,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php switch ($i) { case 0: print "i equals 0"; @@ -857,6 +892,7 @@ default: print "i is not equal to 0, 1 or 2"; } +?> ]]> </programlisting> </informalexample> @@ -875,6 +911,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php switch ($i): case 0: print "i equals 0"; @@ -888,6 +925,7 @@ default: print "i is not equal to 0, 1 or 2"; endswitch; +?> ]]> </programlisting> </informalexample> @@ -932,6 +970,7 @@ <informalexample> <programlisting> <![CDATA[ +<?php // these are the same: // you can use this: @@ -942,6 +981,7 @@ // or you can use this: declare(ticks=1); // entire script here +?> ]]> </programlisting> </informalexample> @@ -1414,8 +1454,10 @@ <title><function>require_once</function> is case sensitive</title> <programlisting role="php"> <![CDATA[ +<?php require_once("a.php"); // this will include a.php require_once("A.php"); // this will include a.php again on Windows! +?> ]]> </programlisting> </example> @@ -1468,8 +1510,10 @@ <title><function>include_once</function> is case sensitive</title> <programlisting role="php"> <![CDATA[ +<?php include_once("a.php"); // this will include a.php include_once("A.php"); // this will include a.php again on Windows! +?> ]]> </programlisting> </example> Index: phpdoc/en/language/expressions.xml diff -u phpdoc/en/language/expressions.xml:1.19 phpdoc/en/language/expressions.xml:1.20 --- phpdoc/en/language/expressions.xml:1.19 Wed Dec 12 15:47:38 2001 +++ phpdoc/en/language/expressions.xml Mon Jun 9 15:28:28 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.19 $ --> +<!-- $Revision: 1.20 $ --> <chapter id="language.expressions"> <title>Expressions</title> @@ -29,10 +29,12 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php function foo () { return 5; } +?> ]]> </programlisting> </informalexample></para> @@ -130,7 +132,9 @@ <informalexample><programlisting> <![CDATA[ +<?php $first ? $second : $third +?> ]]> </programlisting></informalexample> @@ -147,6 +151,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php function double($i) { return $i*2; @@ -167,6 +172,7 @@ value of 24. the value of the assignment (24) is then assigned into $h, and $h ends with the value of 24 as well. */ +?> ]]> </programlisting> </informalexample> Index: phpdoc/en/language/functions.xml diff -u phpdoc/en/language/functions.xml:1.38 phpdoc/en/language/functions.xml:1.39 --- phpdoc/en/language/functions.xml:1.38 Sat May 17 13:08:09 2003 +++ phpdoc/en/language/functions.xml Mon Jun 9 15:28:28 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.38 $ --> +<!-- $Revision: 1.39 $ --> <chapter id="functions"> <title>Functions</title> @@ -168,10 +168,12 @@ <title>Passing arrays to functions</title> <programlisting role="php"> <![CDATA[ +<?php function takes_array($input) { echo "$input[0] + $input[1] = ", $input[0]+$input[1]; } +?> ]]> </programlisting> </example> Index: phpdoc/en/language/oop.xml diff -u phpdoc/en/language/oop.xml:1.40 phpdoc/en/language/oop.xml:1.41 --- phpdoc/en/language/oop.xml:1.40 Sat Apr 5 05:03:45 2003 +++ phpdoc/en/language/oop.xml Mon Jun 9 15:28:28 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.40 $ --> +<!-- $Revision: 1.41 $ --> <chapter id="language.oop"> <title>Classes and Objects</title> @@ -131,6 +131,7 @@ $another_cart = new Cart; $another_cart->add_item("0815", 3); +?> ]]> </programlisting> </informalexample> @@ -164,6 +165,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php // correct, single $ $cart->items = array("10" => 1); @@ -174,6 +176,7 @@ // $cart->$myvar becomes $cart->items $myvar = 'items'; $cart->$myvar = array("10" => 1); +?> ]]> </programlisting> </informalexample> @@ -223,6 +226,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php class Named_Cart extends Cart { var $owner; @@ -232,6 +236,7 @@ $this->owner = $name; } } +?> ]]> </programlisting> </informalexample> @@ -247,10 +252,12 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php $ncart = new Named_Cart; // Create a named cart $ncart->set_owner("kris"); // Name that cart print $ncart->owner; // print the cart owners name $ncart->add_item("10", 1); // (inherited functionality from cart) +?> ]]> </programlisting> </informalexample> @@ -299,6 +306,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php // Works in PHP 3 and PHP 4. class Auto_Cart extends Cart { @@ -307,6 +315,7 @@ $this->add_item ("10", 1); } } +?> ]]> </programlisting> </informalexample> @@ -324,6 +333,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php // Works in PHP 3 and PHP 4. class Constructor_Cart extends Cart { @@ -340,6 +350,7 @@ // Shop for real... $different_cart = new Constructor_Cart("20", 17); +?> ]]> </programlisting> </informalexample> @@ -361,6 +372,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php class A { function A() @@ -379,6 +391,7 @@ // no constructor is being called in PHP 3. $b = new B; +?> ]]> </programlisting> </informalexample> @@ -400,6 +413,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php class A { function A() @@ -424,6 +438,7 @@ // This will call B() as a constructor. $b = new B; +?> ]]> </programlisting> </informalexample> @@ -488,6 +503,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php class A { function example() @@ -517,6 +533,7 @@ // I am the redefined function B::example().<br> // I am the original function A::example().<br> $b->example(); +?> ]]> </programlisting> </informalexample> @@ -581,6 +598,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php class A { function example() @@ -602,6 +620,7 @@ // This will call B::example(), which will in turn call A::example(). $b->example(); +?> ]]> </programlisting> </informalexample> @@ -652,7 +671,9 @@ <informalexample> <programlisting role="php"> <![CDATA[ -classa.inc: +<?php +// classa.inc: + class A { var $one = 1; @@ -663,7 +684,8 @@ } } -page1.php: +// page1.php: + include("classa.inc"); $a = new A; @@ -673,7 +695,8 @@ fputs($fp, $s); fclose($fp); -page2.php: +// page2.php: + // this is needed for the unserialize to work properly. include("classa.inc"); @@ -682,6 +705,7 @@ // now use the function show_one() of the $a object. $a->show_one(); +?> ]]> </programlisting> </informalexample> @@ -757,6 +781,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php class Foo { function Foo($name) @@ -780,6 +805,7 @@ $this->name = $name; } } +?> ]]> </programlisting> </informalexample> @@ -795,6 +821,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php $bar1 = new Foo('set in constructor'); $bar1->echoName(); $globalref[0]->echoName(); @@ -812,6 +839,7 @@ set in constructor set in constructor set in constructor */ +?> ]]> </programlisting> </informalexample> @@ -839,6 +867,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php // now we will change the name. what do you expect? // you could expect that both $bar1 and $globalref[0] change their names... $bar1->setName('set from outside'); @@ -862,6 +891,7 @@ /* output: set from outside set from outside */ +?> ]]> </programlisting> </informalexample> @@ -872,6 +902,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php class A { function A($i) @@ -930,6 +961,7 @@ class B: 11 class B: 11 */ +?> ]]> </programlisting> </informalexample> @@ -950,6 +982,7 @@ <title>Example of object comparison in PHP 4</title> <programlisting role='php'> <![CDATA[ +<?php function bool2str($bool) { if ($bool === false) { return 'FALSE'; @@ -998,6 +1031,7 @@ echo "\nCompare an instance of a parent class with one from a subclass\n"; compareObjects($o, $r); +?> ]]> </programlisting> </example> @@ -1033,6 +1067,7 @@ <title>Compound object comparisons in PHP 4</title> <programlisting role='php'> <![CDATA[ +<?php class FlagSet { var $set; @@ -1063,7 +1098,7 @@ echo "\nu(o,p) and w(q)\n"; compareObjects($u, $w); - +?> ]]> </programlisting> </example> @@ -1109,6 +1144,7 @@ <title>Example of object comparison in PHP 5</title> <programlisting role='php'> <![CDATA[ +<?php function bool2str($bool) { if ($bool === false) { return 'FALSE'; @@ -1157,6 +1193,7 @@ echo "\nInstances of similarly named classes in different namespaces\n"; compareObjects($o, $r); +?> ]]> </programlisting> </example> @@ -1181,7 +1218,7 @@ o1 !== o2 : TRUE </screen> </para> - </sect1> + </sect1> </chapter> <!-- Keep this comment at the end of the file Index: phpdoc/en/language/references.xml diff -u phpdoc/en/language/references.xml:1.24 phpdoc/en/language/references.xml:1.25 --- phpdoc/en/language/references.xml:1.24 Sun Jun 30 06:41:42 2002 +++ phpdoc/en/language/references.xml Mon Jun 9 15:28:28 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.24 $ --> +<!-- $Revision: 1.25 $ --> <chapter id="language.references"> <title>References Explained</title> @@ -25,7 +25,9 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php $a =& $b +?> ]]> </programlisting> </informalexample> @@ -47,8 +49,10 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php $bar =& new fooclass(); $foo =& find_var ($bar); +?> ]]> </programlisting> </informalexample> @@ -78,6 +82,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php function foo (&$var) { $var++; @@ -85,6 +90,7 @@ $a=5; foo ($a); +?> ]]> </programlisting> </informalexample> @@ -108,11 +114,13 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php function foo (&$var) { $var =& $GLOBALS["baz"]; } foo($bar); +?> ]]> </programlisting> </informalexample> @@ -139,6 +147,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php function foo (&$var) { $var++; @@ -147,6 +156,7 @@ $a=5; foo ($a); // $a is 6 here +?> ]]> </programlisting> </informalexample> @@ -173,12 +183,14 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php function &bar() { $a = 5; return $a; } foo(bar()); +?> ]]> </programlisting> </informalexample> @@ -195,6 +207,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php function bar() // Note the missing & { $a = 5; @@ -204,6 +217,7 @@ foo($a = 5) // Expression, not variable foo(5) // Constant, not variable +?> ]]> </programlisting> </informalexample> @@ -220,6 +234,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php function &find_var ($param) { ...code... @@ -228,6 +243,7 @@ $foo =& find_var ($bar); $foo->x = 2; +?> ]]> </programlisting> </informalexample> @@ -255,9 +271,11 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php $a = 1; $b =& $a; unset ($a); +?> ]]> </programlisting> </informalexample> @@ -288,7 +306,9 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php $var =& $GLOBALS["var"]; +?> ]]> </programlisting> </informalexample>
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php