didou Tue Jan 6 04:20:49 2004 EDT
Modified files:
/phpdoc/en/language control-structures.xml functions.xml oop.xml
variables.xml
Log:
more CS
Index: phpdoc/en/language/control-structures.xml
diff -u phpdoc/en/language/control-structures.xml:1.83
phpdoc/en/language/control-structures.xml:1.84
--- phpdoc/en/language/control-structures.xml:1.83 Fri Dec 12 14:56:00 2003
+++ phpdoc/en/language/control-structures.xml Tue Jan 6 04:20:49 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.83 $ -->
+<!-- $Revision: 1.84 $ -->
<chapter id="control-structures">
<title>Control Structures</title>
@@ -561,11 +561,11 @@
$arr = array("one", "two", "three");
reset ($arr);
while (list(, $value) = each ($arr)) {
- echo "Value: $value<br>\n";
+ echo "Value: $value<br />\n";
}
foreach ($arr as $value) {
- echo "Value: $value<br>\n";
+ echo "Value: $value<br />\n";
}
?>
]]>
@@ -578,11 +578,11 @@
<?php
reset ($arr);
while (list($key, $value) = each ($arr)) {
- echo "Key: $key; Value: $value<br>\n";
+ echo "Key: $key; Value: $value<br />\n";
}
foreach ($arr as $key => $value) {
- echo "Key: $key; Value: $value<br>\n";
+ echo "Key: $key; Value: $value<br />\n";
}
?>
]]>
@@ -675,7 +675,7 @@
if ($val == 'stop') {
break; /* You could also write 'break 1;' here. */
}
- echo "$val<br>\n";
+ echo "$val<br />\n";
}
/* Using the optional argument. */
@@ -684,10 +684,10 @@
while (++$i) {
switch ($i) {
case 5:
- echo "At 5<br>\n";
+ echo "At 5<br />\n";
break 1; /* Exit only the switch. */
case 10:
- echo "At 10; quitting<br>\n";
+ echo "At 10; quitting<br />\n";
break 2; /* Exit the switch and the while. */
default:
break;
@@ -734,16 +734,16 @@
$i = 0;
while ($i++ < 5) {
- echo "Outer<br>\n";
+ echo "Outer<br />\n";
while (1) {
- echo " Middle<br>\n";
+ echo " Middle<br />\n";
while (1) {
- echo " Inner<br>\n";
+ echo " Inner<br />\n";
continue 3;
}
- echo "This never gets output.<br>\n";
+ echo "This never gets output.<br />\n";
}
- echo "Neither does this.<br>\n";
+ echo "Neither does this.<br />\n";
}
?>
]]>
Index: phpdoc/en/language/functions.xml
diff -u phpdoc/en/language/functions.xml:1.43 phpdoc/en/language/functions.xml:1.44
--- phpdoc/en/language/functions.xml:1.43 Thu Dec 11 10:41:57 2003
+++ phpdoc/en/language/functions.xml Tue Jan 6 04:20:49 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.43 $ -->
+<!-- $Revision: 1.44 $ -->
<chapter id="functions">
<title>Functions</title>
@@ -440,14 +440,13 @@
<programlisting role="php">
<![CDATA[
<?php
-function foo()
-{
- echo "In foo()<br>\n";
+function foo() {
+ echo "In foo()<br />\n";
}
function bar($arg = '')
{
- echo "In bar(); argument was '$arg'.<br>\n";
+ echo "In bar(); argument was '$arg'.<br />\n";
}
// This is a wrapper function around echo
Index: phpdoc/en/language/oop.xml
diff -u phpdoc/en/language/oop.xml:1.48 phpdoc/en/language/oop.xml:1.49
--- phpdoc/en/language/oop.xml:1.48 Sun Dec 21 10:59:19 2003
+++ phpdoc/en/language/oop.xml Tue Jan 6 04:20:49 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.48 $ -->
+<!-- $Revision: 1.49 $ -->
<chapter id="language.oop">
<title>Classes and Objects</title>
@@ -14,21 +14,18 @@
<programlisting role="php">
<![CDATA[
<?php
-class Cart
-{
+class Cart {
var $items; // Items in our shopping cart
// Add $num articles of $artnr to the cart
- function add_item ($artnr, $num)
- {
+ function add_item($artnr, $num) {
$this->items[$artnr] += $num;
}
// Take $num articles of $artnr out of the cart
- function remove_item ($artnr, $num)
- {
+ function remove_item($artnr, $num) {
if ($this->items[$artnr] > $num) {
$this->items[$artnr] -= $num;
return true;
@@ -114,8 +111,7 @@
<programlisting role="php">
<![CDATA[
<?php
-class Cart
-{
+class Cart {
/* None of these will work in PHP 4. */
var $todays_date = date("Y-m-d");
var $name = $firstname;
@@ -125,15 +121,13 @@
}
/* This is how it should be done. */
-class Cart
-{
+class Cart {
var $todays_date;
var $name;
var $owner;
var $items = array("VCR", "TV");
- function Cart()
- {
+ function Cart() {
$this->todays_date = date("Y-m-d");
$this->name = $GLOBALS['firstname'];
/* etc. . . */
@@ -257,12 +251,10 @@
<programlisting role="php">
<![CDATA[
<?php
-class Named_Cart extends Cart
-{
+class Named_Cart extends Cart {
var $owner;
- function set_owner ($name)
- {
+ function set_owner ($name) {
$this->owner = $name;
}
}
@@ -338,11 +330,9 @@
<![CDATA[
<?php
// Works in PHP 3 and PHP 4.
-class Auto_Cart extends Cart
-{
- function Auto_Cart()
- {
- $this->add_item ("10", 1);
+class Auto_Cart extends Cart {
+ function Auto_Cart() {
+ $this->add_item("10", 1);
}
}
?>
@@ -365,10 +355,8 @@
<![CDATA[
<?php
// Works in PHP 3 and PHP 4.
-class Constructor_Cart extends Cart
-{
- function Constructor_Cart($item = "10", $num = 1)
- {
+class Constructor_Cart extends Cart {
+ function Constructor_Cart($item = "10", $num = 1) {
$this->add_item ($item, $num);
}
}
@@ -403,19 +391,15 @@
<programlisting role="php">
<![CDATA[
<?php
-class A
-{
- function A()
- {
- echo "I am the constructor of A.<br>\n";
+class A {
+ function A() {
+ echo "I am the constructor of A.<br />\n";
}
}
-class B extends A
-{
- function C()
- {
- echo "I am a regular function.<br>\n";
+class B extends A {
+ function C() {
+ echo "I am a regular function.<br />\n";
}
}
@@ -437,7 +421,7 @@
This is fixed in PHP 4 by introducing another rule: If a class
has no constructor, the constructor of the base class is being
called, if it exists. The above example would have printed
- 'I am the constructor of A.<br>' in PHP 4.
+ 'I am the constructor of A.<br />' in PHP 4.
</para>
<informalexample>
@@ -448,13 +432,13 @@
{
function A()
{
- echo "I am the constructor of A.<br>\n";
+ echo "I am the constructor of A.<br />\n";
}
function B()
{
- echo "I am a regular function named B in class A.<br>\n";
- echo "I am not a constructor in A.<br>\n";
+ echo "I am a regular function named B in class A.<br />\n";
+ echo "I am not a constructor in A.<br />\n";
}
}
@@ -462,7 +446,7 @@
{
function C()
{
- echo "I am a regular function.<br>\n";
+ echo "I am a regular function.<br />\n";
}
}
@@ -486,7 +470,7 @@
is a function of the same name as the class it is being defined
in.'. Thus in PHP 4, the class B would have no constructor function
of its own and the constructor of the base class would have been
- called, printing 'I am the constructor of A.<br>'.
+ called, printing 'I am the constructor of A.<br />'.
</para>
<caution>
@@ -534,34 +518,30 @@
<programlisting role="php">
<![CDATA[
<?php
-class A
-{
- function example()
- {
- echo "I am the original function A::example().<br>\n";
+class A {
+ function example() {
+ echo "I am the original function A::example().<br />\n";
}
}
-class B extends A
-{
- function example()
- {
- echo "I am the redefined function B::example().<br>\n";
+class B extends A {
+ function example() {
+ echo "I am the redefined function B::example().<br />\n";
A::example();
}
}
// there is no object of class A.
// this will print
-// I am the original function A::example().<br>
+// I am the original function A::example().<br />
A::example();
// create an object of class B.
$b = new B;
// this will print
-// I am the redefined function B::example().<br>
-// I am the original function A::example().<br>
+// I am the redefined function B::example().<br />
+// I am the original function A::example().<br />
$b->example();
?>
]]>
@@ -629,19 +609,15 @@
<programlisting role="php">
<![CDATA[
<?php
-class A
-{
- function example()
- {
- echo "I am A::example() and provide basic functionality.<br>\n";
+class A {
+ function example() {
+ echo "I am A::example() and provide basic functionality.<br />\n";
}
}
-class B extends A
-{
- function example()
- {
- echo "I am B::example() and provide additional functionality.<br>\n";
+class B extends A {
+ function example() {
+ echo "I am B::example() and provide additional functionality.<br />\n";
parent::example();
}
}
@@ -703,12 +679,10 @@
<?php
// classa.inc:
- class A
- {
+ class A {
var $one = 1;
- function show_one()
- {
+ function show_one() {
echo $this->one;
}
}
@@ -811,10 +785,8 @@
<programlisting role="php">
<![CDATA[
<?php
-class Foo
-{
- function Foo($name)
- {
+class Foo {
+ function Foo($name) {
// create a reference inside the global array $globalref
global $globalref;
$globalref[] = &$this;
@@ -824,13 +796,11 @@
$this->echoName();
}
- function echoName()
- {
- echo "<br>",$this->name;
+ function echoName() {
+ echo "<br />", $this->name;
}
- function setName($name)
- {
+ function setName($name) {
$this->name = $name;
}
}
@@ -932,37 +902,30 @@
<programlisting role="php">
<![CDATA[
<?php
-class A
-{
- function A($i)
- {
+class A {
+ function A($i) {
$this->value = $i;
// try to figure out why we do not need a reference here
$this->b = new B($this);
}
- function createRef()
- {
+ function createRef() {
$this->c = new B($this);
}
- function echoValue()
- {
- echo "<br>","class ",get_class($this),': ',$this->value;
+ function echoValue() {
+ echo "<br />","class ",get_class($this),': ',$this->value;
}
}
-class B
-{
- function B(&$a)
- {
+class B {
+ function B(&$a) {
$this->a = &$a;
}
- function echoValue()
- {
- echo "<br>","class ",get_class($this),': ',$this->a->value;
+ function echoValue() {
+ echo "<br />","class ",get_class($this),': ',$this->a->value;
}
}
@@ -981,18 +944,22 @@
$a->b->echoValue(); // *
$a->c->echoValue();
-/*
-output:
+?>
+]]>
+ </programlisting>
+ <para>
+ This example will output:
+ </para>
+ <screen>
+<![CDATA[
class A: 10
class B: 10
class B: 10
class A: 11
class B: 11
class B: 11
-*/
-?>
]]>
- </programlisting>
+ </screen>
</informalexample>
</para>
</sect1>
Index: phpdoc/en/language/variables.xml
diff -u phpdoc/en/language/variables.xml:1.73 phpdoc/en/language/variables.xml:1.74
--- phpdoc/en/language/variables.xml:1.73 Sun Jan 4 21:09:54 2004
+++ phpdoc/en/language/variables.xml Tue Jan 6 04:20:49 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.73 $ -->
+<!-- $Revision: 1.74 $ -->
<chapter id="language.variables">
<title>Variables</title>
@@ -807,10 +807,10 @@
<title>A simple HTML form</title>
<programlisting role="html">
<![CDATA[
-<form action="foo.php" method="POST">
- Name: <input type="text" name="username"><br>
- Email: <input type="text" name="email"><br>
- <input type="submit" name="submit" value="Submit me!">
+<form action="foo.php" method="post">
+ Name: <input type="text" name="username" /><br />
+ Email: <input type="text" name="email" /><br />
+ <input type="submit" name="submit" value="Submit me!" />
</form>
]]>
</programlisting>
@@ -912,17 +912,17 @@
echo '</pre>';
} else {
?>
-<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
- Name: <input type="text" name="personal[name]"><br>
- Email: <input type="text" name="personal[email]"><br>
- Beer: <br>
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+ Name: <input type="text" name="personal[name]" /><br />
+ Email: <input type="text" name="personal[email]" /><br />
+ Beer: <br />
<select multiple name="beer[]">
<option value="warthog">Warthog</option>
<option value="guinness">Guinness</option>
<option value="stuttgarter">Stuttgarter Schwabenbr�u</option>
- </select><br>
- <input type="hidden" name="action" value="submitted">
- <input type="submit" name="submit" value="submit me!">
+ </select><br />
+ <input type="hidden" name="action" value="submitted" />
+ <input type="submit" name="submit" value="submit me!" />
</form>
<?php
}
@@ -948,7 +948,7 @@
<informalexample>
<programlisting role="html">
<![CDATA[
-<input type="image" src="image.gif" name="sub">
+<input type="image" src="image.gif" name="sub" />
]]>
</programlisting>
</informalexample>