cvs: phpdoc /en/functions apache.xml array.xml aspell.xml bzip2.xml calendar.xml classobj.xml com.xml cpdf.xml curl.xml cybermut.xml datetime.xml
dba.xml dbase.xml dbm.xml dbx.xml dir.xml domxml.xml errorfunc.xml exec.xml fbsql.xml fdf.xml filesystem.xml ftp.xml funchand.xml gettext.xml gmp.xml
http.xml hw.xml ibase.xml iconv.xml ifx.xml image.xml imap.xml info.xml ingres_ii.xml ircg.xml java.xml ldap.xml mail.xml math.xml mbstring.xml

From: Date: Sun, 18 Nov 2001 03:07:19 +0000
Subject: cvs: phpdoc /en/functions apache.xml array.xml aspell.xml bzip2.xml calendar.xml classobj.xml com.xml cpdf.xml curl.xml cybermut.xml datetime.xml
dba.xml dbase.xml dbm.xml dbx.xml dir.xml domxml.xml errorfunc.xml exec.xml fbsql.xml fdf.xml filesystem.xml ftp.xml funchand.xml gettext.xml gmp.xml
http.xml hw.xml ibase.xml iconv.xml ifx.xml image.xml imap.xml info.xml ingres_ii.xml ircg.xml java.xml ldap.xml mail.xml math.xml mbstring.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969338961@lists.php.net to get a copy of this message
hholzgra Sat Nov 17 22:07:19 2001 EDT Modified files: /phpdoc/en/functions apache.xml array.xml aspell.xml bzip2.xml calendar.xml classobj.xml com.xml cpdf.xml curl.xml cybermut.xml datetime.xml dba.xml dbase.xml dbm.xml dbx.xml dir.xml domxml.xml errorfunc.xml exec.xml fbsql.xml fdf.xml filesystem.xml ftp.xml funchand.xml gettext.xml gmp.xml http.xml hw.xml ibase.xml iconv.xml ifx.xml image.xml imap.xml info.xml ingres_ii.xml ircg.xml java.xml ldap.xml mail.xml math.xml mbstring.xml Log: started to wrap up all <programlisting> environments in CDATA sections to allow verbatim examples having to use entities for &, < and > makes the code hard to read and errors might slip in during the process, so the two extra lines should be worth the effort

Index: phpdoc/en/functions/apache.xml diff -u phpdoc/en/functions/apache.xml:1.16 phpdoc/en/functions/apache.xml:1.17 --- phpdoc/en/functions/apache.xml:1.16 Sat Nov 10 16:49:31 2001 +++ phpdoc/en/functions/apache.xml Sat Nov 17 22:07:16 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <reference id="ref.apache"> <title>Apache-specific Functions</title> <titleabbrev>Apache</titleabbrev> @@ -173,10 +173,12 @@ <example> <title><function>getallheaders</function> Example</title> <programlisting role="php"> +<![CDATA[ $headers = getallheaders(); while (list ($header, $value) = each ($headers)) { echo "$header: $value&lt;br&gt;\n"; } +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/array.xml diff -u phpdoc/en/functions/array.xml:1.122 phpdoc/en/functions/array.xml:1.123 --- phpdoc/en/functions/array.xml:1.122 Thu Nov 15 02:51:42 2001 +++ phpdoc/en/functions/array.xml Sat Nov 17 22:07:16 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.122 $ --> +<!-- $Revision: 1.123 $ --> <reference id="ref.array"> <title>Array Functions</title> <titleabbrev>Arrays</titleabbrev> @@ -72,11 +72,13 @@ <example> <title><function>array</function> example</title> <programlisting role="php"> +<![CDATA[ $fruits = array ( - "fruits" =&gt; array ("a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple"), - "numbers" =&gt; array (1, 2, 3, 4, 5, 6), - "holes" =&gt; array ("first", 5 =&gt; "second", "third") + "fruits" => array ("a"=>"orange", "b"=>"banana", "c"=>"apple"), + "numbers" => array (1, 2, 3, 4, 5, 6), + "holes" => array ("first", 5 => "second", "third") ); +]]> </programlisting> </example> </para> @@ -84,13 +86,16 @@ <example> <title>Automatic index with <function>array</function></title> <programlisting role="php"> +<![CDATA[ $array = array( 1, 1, 1, 1, 1, 8=>1, 4=>1, 19, 3=>13); print_r($array); +]]> </programlisting> </example> which will display : <informalexample> <programlisting> +<![CDATA[ Array ( [0] => 1 @@ -101,6 +106,7 @@ [8] => 1 [9] => 19 ) +]]> </programlisting> </informalexample> Note that index '3' is defined twice, and keep its final value of 13. @@ -112,19 +118,23 @@ <example> <title>1-based index with <function>array</function></title> <programlisting role="php"> +<![CDATA[ $firstquarter = array(1 => 'January', 'February', 'March'); print_r($firstquarter); +]]> </programlisting> </example> which will display : <informalexample> <programlisting> +<![CDATA[ Array ( [1] => 'January' [2] => 'February' [3] => 'March' ) +]]> </programlisting> </informalexample> </para> @@ -163,18 +173,22 @@ <example> <title><function>array_change_key_case</function> example</title> <programlisting role="php"> +<![CDATA[ $input_array = array("FirSt" => 1, "SecOnd" => 4); print_r(array_change_key_case($input_array, CASE_UPPER); +]]> </programlisting> </example> The printout of the above program will be: <informalexample> <programlisting> +<![CDATA[ Array ( [FIRST] => 1 [SECOND] => 2 ) +]]> </programlisting> </informalexample> </para> @@ -215,14 +229,17 @@ <example> <title><function>array_chunk</function> example</title> <programlisting role="php"> +<![CDATA[ $input_array = array('a', 'b', 'c', 'd', 'e'); print_r(array_chunk($input_array, 2)); print_r(array_chunk($input_array, 2, TRUE)); +]]> </programlisting> </example> The printout of the above program will be: <informalexample> <programlisting> +<![CDATA[ Array ( [0] => Array @@ -263,6 +280,7 @@ ) ) +]]> </programlisting> </informalexample> </para> @@ -291,8 +309,10 @@ <example> <title><function>array_count_values</function> example</title> <programlisting role="php"> +<![CDATA[ $array = array (1, "hello", 1, "world", "hello"); -array_count_values ($array); // returns array (1=&gt;2, "hello"=&gt;2, "world"=&gt;1) +array_count_values ($array); // returns array (1=>2, "hello"=>2, "world"=>1) +]]> </programlisting> </example> </para> @@ -326,9 +346,11 @@ <example> <title><function>array_diff</function> example</title> <programlisting role="php"> -$array1 = array ("a" =&gt; "green", "red", "blue", "red"); -$array2 = array ("b" =&gt; "green", "yellow", "red"); +<![CDATA[ +$array1 = array ("a" => "green", "red", "blue", "red"); +$array2 = array ("b" => "green", "yellow", "red"); $result = array_diff ($array1, $array2); +]]> </programlisting> </example> </para> @@ -386,6 +408,7 @@ <example> <title><function>array_filter</function> example</title> <programlisting role="php"> +<![CDATA[ function odd($var) { return ($var % 2 == 1); } @@ -394,11 +417,12 @@ return ($var % 2 == 0); } -$array1 = array ("a"=&gt;1, "b"=&gt;2, "c"=&gt;3, "d"=&gt;4, "e"=&gt;5); +$array1 = array ("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5); $array2 = array (6, 7, 8, 9, 10, 11, 12); $odd_arr = array_filter($array1, "odd"); $even_arr = array_filter($array2, "even"); +]]> </programlisting> </example> </para> @@ -452,8 +476,10 @@ <example> <title><function>array_flip</function> example</title> <programlisting role="php"> +<![CDATA[ $trans = array_flip ($trans); $original = strtr ($str, $trans); +]]> </programlisting> </example> </para> @@ -461,9 +487,11 @@ <example> <title><function>array_flip</function> example : collision</title> <programlisting role="php"> +<![CDATA[ $trans = array ("a" => 1, "b" => 1, "c" => 2); $trans = array_flip ($trans); // now $trans is : array(1 => "b", 2 => "c"); +]]> </programlisting> </example> </para> @@ -495,6 +523,7 @@ <example> <title><function>array_fill</function> example</title> <programlisting role="php"> +<![CDATA[ $a = array_fill(5, 6, 'banana'); /* @@ -507,6 +536,7 @@ $a[9] = "banana"; $a[10] = "banana"; */ +]]> </programlisting> </example> </para> @@ -540,9 +570,11 @@ <example> <title><function>array_intersect</function> example</title> <programlisting role="php"> -$array1 = array ("a" =&gt; "green", "red", "blue"); -$array2 = array ("b" =&gt; "green", "yellow", "red"); +<![CDATA[ +$array1 = array ("a" => "green", "red", "blue"); +$array2 = array ("b" => "green", "yellow", "red"); $result = array_intersect ($array1, $array2); +]]> </programlisting> </example> </para> @@ -594,10 +626,12 @@ <example> <title><function>array_key_exists</function> example</title> <programlisting role="php"> +<![CDATA[ $search_array = array("first" => 1, "second" => 4); if (array_key_exists("first", $search_array)) { echo "The 'first' element is in the array"; } +]]> </programlisting> </example> </para> @@ -644,14 +678,16 @@ <example> <title><function>array_keys</function> example</title> <programlisting role="php"> -$array = array (0 =&gt; 100, "color" =&gt; "red"); +<![CDATA[ +$array = array (0 => 100, "color" => "red"); array_keys ($array); // returns array (0, "color") $array = array ("blue", "red", "green", "blue", "blue"); array_keys ($array, "blue"); // returns array (0, 3, 4) -$array = array ("color" =&gt; array("blue", "red", "green"), "size" =&gt; array("small", "medium", "large")); +$array = array ("color" => array("blue", "red", "green"), "size" => array("small", "medium", "large")); array_keys ($array); // returns array ("color", "size") +]]> </programlisting> </example> </para> @@ -665,16 +701,18 @@ users </title> <programlisting role="php"> +<![CDATA[ function array_keys ($arr, $term="") { $t = array(); while (list($k,$v) = each($arr)) { - if ($term &amp;&amp; $v != $term) { + if ($term && $v != $term) { continue; $t[] = $k; } return $t; } } +]]> </programlisting> </example> </para> @@ -715,12 +753,14 @@ <example> <title><function>array_map</function> example</title> <programlisting role="php"> +<![CDATA[ function cube($n) { return $n*$n*$n; } $a = array(1, 2, 3, 4, 5); $b = array_map("cube", $a); +]]> </programlisting> </example> </para> @@ -732,6 +772,7 @@ <example> <title><function>array_map</function> - using more arrays</title> <programlisting role="php"> +<![CDATA[ function show_Spanish($n, $m) { return "The number $n is called $m in Spanish"; } @@ -790,6 +831,7 @@ // ) // // ) +]]> </programlisting> </example> </para> @@ -809,6 +851,7 @@ <example> <title>Creating an array of arrays</title> <programlisting role="php"> +<![CDATA[ $a = array(1, 2, 3, 4, 5); $b = array("one", "two", "three", "four", "five"); $c = array("uno", "dos", "tres", "cuatro", "cinco"); @@ -855,6 +898,7 @@ // ) // // ) +]]> </programlisting> </example> </para> @@ -897,9 +941,11 @@ <example> <title><function>array_merge</function> example</title> <programlisting role="php"> -$array1 = array ("color" =&gt; "red", 2, 4); -$array2 = array ("a", "b", "color" =&gt; "green", "shape" =&gt; "trapezoid", 4); +<![CDATA[ +$array1 = array ("color" => "red", 2, 4); +$array2 = array ("a", "b", "color" => "green", "shape" => "trapezoid", 4); array_merge ($array1, $array2); +]]> </programlisting> </example> </para> @@ -947,9 +993,11 @@ <example> <title><function>array_merge_recursive</function> example</title> <programlisting role="php"> -$ar1 = array ("color" =&gt; array ("favorite" =&gt; "red"), 5); -$ar2 = array (10, "color" =&gt; array ("favorite" =&gt; "green", "blue")); +<![CDATA[ +$ar1 = array ("color" => array ("favorite" => "red"), 5); +$ar2 = array (10, "color" => array ("favorite" => "green", "blue")); $result = array_merge_recursive ($ar1, $ar2); +]]> </programlisting> </example> </para> @@ -1042,9 +1090,11 @@ <example> <title>Sorting multiple arrays</title> <programlisting role="php"> +<![CDATA[ $ar1 = array ("10", 100, 100, "a"); $ar2 = array (1, 3, "2", 1); array_multisort ($ar1, $ar2); +]]> </programlisting> </example> </para> @@ -1058,9 +1108,11 @@ <example> <title>Sorting multi-dimensional array</title> <programlisting role="php"> +<![CDATA[ $ar = array (array ("10", 100, 100, "a"), array (1, 3, "2", 1)); array_multisort ($ar[0], SORT_ASC, SORT_STRING, $ar[1], SORT_NUMERIC, SORT_DESC); +]]> </programlisting> </example> </para> @@ -1105,6 +1157,7 @@ <example> <title><function>array_pad</function> example</title> <programlisting role="php"> +<![CDATA[ $input = array (12, 10, 9); $result = array_pad ($input, 5, 0); @@ -1115,6 +1168,7 @@ $result = array_pad ($input, 2, "noop"); // not padded +]]> </programlisting> </example> </para> @@ -1145,8 +1199,10 @@ <example> <title><function>array_pop</function> example</title> <programlisting role="php"> +<![CDATA[ $stack = array ("orange", "apple", "raspberry"); $fruit = array_pop ($stack); +]]> </programlisting> </example> </para> @@ -1189,7 +1245,9 @@ length of <parameter>array</parameter> increases by the number of variables pushed. Has the same effect as: <programlisting role="php"> +<![CDATA[ $array[] = $var; +]]> </programlisting> repeated for each <parameter>var</parameter>. </para> @@ -1200,8 +1258,10 @@ <example> <title><function>array_push</function> example</title> <programlisting role="php"> +<![CDATA[ $stack = array (1, 2); array_push ($stack, "+", 3); +]]> </programlisting> </example> </para> @@ -1256,11 +1316,13 @@ <example> <title><function>array_rand</function> example</title> <programlisting role="php"> +<![CDATA[ srand ((float) microtime() * 10000000); $input = array ("Neo", "Morpheus", "Trinity", "Cypher", "Tank"); $rand_keys = array_rand ($input, 2); print $input[$rand_keys[0]]."\n"; print $input[$rand_keys[1]]."\n"; +]]> </programlisting> </example> </para> @@ -1295,9 +1357,11 @@ <example> <title><function>array_reverse</function> example</title> <programlisting role="php"> +<![CDATA[ $input = array ("php", 4.0, array ("green", "red")); $result = array_reverse ($input); $result_keyed = array_reverse ($input, TRUE); +]]> </programlisting> </example> </para> @@ -1348,6 +1412,7 @@ <example> <title><function>array_reduce</function> example</title> <programlisting role="php"> +<![CDATA[ function rsum($v, $w) { $v += $w; return $v; @@ -1363,6 +1428,7 @@ $b = array_reduce($a, "rsum"); $c = array_reduce($a, "rmul", 10); $d = array_reduce($x, "rsum", 1); +]]> </programlisting> </example> </para> @@ -1405,8 +1471,10 @@ <example> <title><function>array_shift</function> example</title> <programlisting role="php"> +<![CDATA[ $args = array ("-v", "-f"); $opt = array_shift ($args); +]]> </programlisting> </example> </para> @@ -1466,12 +1534,14 @@ <example> <title><function>array_slice</function> examples</title> <programlisting role="php"> +<![CDATA[ $input = array ("a", "b", "c", "d", "e"); $output = array_slice ($input, 2); // returns "c", "d", and "e" $output = array_slice ($input, 2, -1); // returns "c", "d" $output = array_slice ($input, -2, 1); // returns "d" $output = array_slice ($input, 0, 3); // returns "a", "b", and "c" +]]> </programlisting> </example> </para> @@ -1548,12 +1618,14 @@ <para> The following equivalences hold: <programlisting role="php"> +<![CDATA[ array_push ($input, $x, $y) array_splice ($input, count ($input), 0, array ($x, $y)) array_pop ($input) array_splice ($input, -1) array_shift ($input) array_splice ($input, 0, 1) array_unshift ($input, $x, $y) array_splice ($input, 0, 0, array ($x, $y)) $a[$x] = $y array_splice ($input, $x, 1, $y) +]]> </programlisting> </para> <para> @@ -1563,6 +1635,7 @@ <example> <title><function>array_splice</function> examples</title> <programlisting role="php"> +<![CDATA[ $input = array ("red", "green", "blue", "yellow"); array_splice ($input, 2); // $input is now array ("red", "green") @@ -1579,6 +1652,7 @@ array_splice ($input, -1, 1, array("black", "maroon")); // $input is now array ("red", "green", // "blue", "black", "maroon") +]]> </programlisting> </example> </para> @@ -1611,6 +1685,7 @@ <example> <title><function>array_sum</function> examples</title> <programlisting role="php"> +<![CDATA[ $a = array(2, 4, 6, 8); echo "sum(a) = ".array_sum($a)."\n"; // prints: sum(a) = 20 @@ -1618,6 +1693,7 @@ $b = array("a"=>1.2,"b"=>2.3,"c"=>3.4); echo "sum(b) = ".array_sum($b)."\n"; // prints: sum(b) = 6.9 +]]> </programlisting> </example> </para> @@ -1668,7 +1744,8 @@ <example> <title><function>array_unique</function> example</title> <programlisting role="php"> -$input = array ("a" =&gt; "green", "red", "b" =&gt; "green", "blue", "red"); +<![CDATA[ +$input = array ("a" => "green", "red", "b" => "green", "blue", "red"); $result = array_unique ($input); print_r($result); // this will output : @@ -1678,6 +1755,7 @@ // [0] => red // [1] => blue //) +]]> </programlisting> </example> </para> @@ -1685,6 +1763,7 @@ <example> <title><function>array_unique</function> and types</title> <programlisting role="php"> +<![CDATA[ $input = array (4,"4","3",4,3,"3"); $result = array_unique ($input); var_dump($result); @@ -1697,6 +1776,7 @@ string(1) "3" } */ +]]> </programlisting> </example> </para> @@ -1738,8 +1818,10 @@ <example> <title><function>array_unshift</function> example</title> <programlisting role="php"> +<![CDATA[ $queue = array ("p1", "p3"); array_unshift ($queue, "p4", "p5", "p6"); +]]> </programlisting> </example> </para> @@ -1776,8 +1858,10 @@ <example> <title><function>array_values</function> example</title> <programlisting role="php"> -$array = array ("size" =&gt; "XL", "color" =&gt; "gold"); +<![CDATA[ +$array = array ("size" => "XL", "color" => "gold"); array_values ($array); // returns array ("XL", "gold") +]]> </programlisting> </example> </para> @@ -1791,6 +1875,7 @@ users </title> <programlisting role="php"> +<![CDATA[ function array_values ($arr) { $t = array(); while (list($k, $v) = each ($arr)) { @@ -1798,6 +1883,7 @@ } return $t; } +]]> </programlisting> </example> </para> @@ -1869,14 +1955,15 @@ <example> <title><function>array_walk</function> example</title> <programlisting role="php"> -$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple"); +<![CDATA[ +$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); -function test_alter (&amp;$item1, $key, $prefix) { +function test_alter (&$item1, $key, $prefix) { $item1 = "$prefix: $item1"; } function test_print ($item2, $key) { - echo "$key. $item2&lt;br&gt;\n"; + echo "$key. $item2<br>\n"; } array_walk ($fruits, 'test_print'); @@ -1884,6 +1971,7 @@ array_walk ($fruits, 'test_alter', 'fruit'); reset ($fruits); array_walk ($fruits, 'test_print'); +]]> </programlisting> </example> </para> @@ -1919,12 +2007,14 @@ <example> <title><function>arsort</function> example</title> <programlisting role="php"> -$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple"); +<![CDATA[ +$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); arsort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } +]]> </programlisting> </example> </para> @@ -1934,10 +2024,12 @@ <para> <informalexample> <programlisting> +<![CDATA[ a = orange d = lemon b = banana c = apple +]]> </programlisting> </informalexample> </para> @@ -1981,12 +2073,14 @@ <example> <title><function>asort</function> example</title> <programlisting role="php"> -$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple"); +<![CDATA[ +$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); asort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } +]]> </programlisting> </example> </para> @@ -1996,10 +2090,12 @@ <para> <informalexample> <programlisting> +<![CDATA[ c = apple b = banana d = lemon a = orange +]]> </programlisting> </informalexample> </para> @@ -2059,6 +2155,7 @@ <example> <title><function>compact</function> example</title> <programlisting role="php"> +<![CDATA[ $city = "San Francisco"; $state = "CA"; $event = "SIGGRAPH"; @@ -2066,6 +2163,7 @@ $location_vars = array ("city", "state"); $result = compact ("event", "nothing_here", $location_vars); +]]> </programlisting> <para> After this, <varname>$result</varname> will be <literal>array @@ -2121,6 +2219,7 @@ <title><function>count</function> example</title> <programlisting role="php"> <!-- TODO: examples about count(null), count(false), count(object).. --> +<![CDATA[ $a[0] = 1; $a[1] = 3; $a[2] = 5; @@ -2132,6 +2231,7 @@ $b[10] = 11; $result = count ($b); // $result == 3; +]]> </programlisting> </example> </para> @@ -2228,8 +2328,10 @@ <example> <title><function>each</function> examples</title> <programlisting role="php"> +<![CDATA[ $foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese"); $bar = each ($foo); +]]> </programlisting> <para> <varname>$bar</varname> now contains the following key/value @@ -2241,8 +2343,10 @@ <listitem><simpara>value =&gt; 'bob'</simpara></listitem> </itemizedlist> <programlisting role="php"> -$foo = array ("Robert" =&gt; "Bob", "Seppo" =&gt; "Sepi"); +<![CDATA[ +$foo = array ("Robert" => "Bob", "Seppo" => "Sepi"); $bar = each ($foo); +]]> </programlisting> </para> <para> @@ -2267,11 +2371,13 @@ <function>each</function> </title> <programlisting role="php"> -echo "Values submitted via POST method:&lt;br&gt;"; +<![CDATA[ +echo "Values submitted via POST method:<br>"; reset ($HTTP_POST_VARS); while (list ($key, $val) = each ($HTTP_POST_VARS)) { - echo "$key =&gt; $val&lt;br&gt;"; + echo "$key => $val<br>"; } +]]> </programlisting> </example> </para> @@ -2432,27 +2538,31 @@ <example> <title><function>extract</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php /* Suppose that $var_array is an array returned from wddx_deserialize */ $size = "large"; -$var_array = array ("color" =&gt; "blue", - "size" =&gt; "medium", - "shape" =&gt; "sphere"); +$var_array = array ("color" => "blue", + "size" => "medium", + "shape" => "sphere"); extract ($var_array, EXTR_PREFIX_SAME, "wddx"); print "$color, $size, $shape, $wddx_size\n"; ?> +]]> </programlisting> </example> </para> <para> The above example will produce: <programlisting> +<![CDATA[ blue, large, sphere, medium +]]> </programlisting> </para> <para> @@ -2508,10 +2618,12 @@ <example> <title><function>in_array</function> example</title> <programlisting role="php"> +<![CDATA[ $os = array ("Mac", "NT", "Irix", "Linux"); if (in_array ("Irix", $os)) { print "Got Irix"; } +]]> </programlisting> </example> </para> @@ -2519,18 +2631,20 @@ <example> <title><function>in_array</function> with strict example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $a = array('1.10', 12.4, 1.13); if (in_array('12.4', $a, TRUE)) - echo &quot;'12.4' found with strict check\n&quot;; + echo "'12.4' found with strict check\n"; if (in_array(1.13, $a, TRUE)) - echo &quot;1.13 found with strict check\n&quot;; -?&gt; + echo "1.13 found with strict check\n"; +?> // This will output: 1.13 found with strict check +]]> </programlisting> </example> </para> @@ -2620,12 +2734,14 @@ <example> <title><function>krsort</function> example</title> <programlisting role="php"> -$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple"); +<![CDATA[ +$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); krsort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } +]]> </programlisting> </example> </para> @@ -2635,10 +2751,12 @@ <para> <informalexample> <programlisting> +<![CDATA[ d = lemon c = apple b = banana a = orange +]]> </programlisting> </informalexample> </para> @@ -2677,12 +2795,14 @@ <example> <title><function>ksort</function> example</title> <programlisting role="php"> -$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple"); +<![CDATA[ +$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); ksort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } +]]> </programlisting> </example> </para> @@ -2692,10 +2812,12 @@ <para> <informalexample> <programlisting> +<![CDATA[ a = orange b = banana c = apple d = lemon +]]> </programlisting> </informalexample> </para> @@ -2739,25 +2861,27 @@ <example> <title><function>list</function> example</title> <programlisting role="php"> -&lt;table> - &lt;tr> - &lt;th>Employee name&lt;/th> - &lt;th>Salary&lt;/th> - &lt;/tr> +<![CDATA[ +<table> + <tr> + <th>Employee name</th> + <th>Salary</th> + </tr> -&lt;?php +<?php $result = mysql_query ($conn, "SELECT id, name, salary FROM employees"); while (list ($id, $name, $salary) = mysql_fetch_row ($result)) { - print (" &lt;tr>\n". - " &lt;td>&lt;a href=\"info.php3?id=$id\">$name&lt;/a>&lt;/td>\n". - " &lt;td>$salary&lt;/td>\n". - " &lt;/tr>\n"); + print (" <tr>\n". + " <td><a href=\"info.php3?id=$id\">$name</a></td>\n". + " <td>$salary</td>\n". + " </tr>\n"); } ?> -&lt;/table> +</table> +]]> </programlisting> </example> </para> @@ -2793,6 +2917,7 @@ <example> <title><function>natsort</function> example</title> <programlisting role="php"> +<![CDATA[ $array1 = $array2 = array ("img12.png", "img10.png", "img2.png", "img1.png"); sort($array1); @@ -2802,6 +2927,7 @@ natsort($array2); echo "\nNatural order sorting\n"; print_r($array2); +]]> </programlisting> </example> </para> @@ -2811,23 +2937,25 @@ <para> <informalexample> <programlisting> +<![CDATA[ Standard sorting Array ( - [0] =&gt; img1.png - [1] =&gt; img10.png - [2] =&gt; img12.png - [3] =&gt; img2.png + [0] => img1.png + [1] => img10.png + [2] => img12.png + [3] => img2.png ) Natural order sorting Array ( - [3] =&gt; img1.png - [2] =&gt; img2.png - [1] =&gt; img10.png - [0] =&gt; img12.png + [3] => img1.png + [2] => img2.png + [1] => img10.png + [0] => img12.png ) +]]> </programlisting> </informalexample> For more information see: Martin Pool's <ulink @@ -3013,6 +3141,7 @@ <example> <title><function>range</function> examples</title> <programlisting role="php"> +<![CDATA[ foreach(range(0, 9) as $number) { echo $number; } @@ -3022,6 +3151,7 @@ foreach(range('z', 'a') as $letter) { echo $letter; } +]]> </programlisting> </example> </para> @@ -3090,12 +3220,14 @@ <example> <title><function>rsort</function> example</title> <programlisting role="php"> +<![CDATA[ $fruits = array ("lemon", "orange", "banana", "apple"); rsort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } +]]> </programlisting> </example> </para> @@ -3105,10 +3237,12 @@ <para> <informalexample> <programlisting> +<![CDATA[ 0 = orange 1 = lemon 2 = banana 3 = apple +]]> </programlisting> </informalexample> </para> @@ -3148,12 +3282,14 @@ <example> <title><function>shuffle</function> example</title> <programlisting role="php"> +<![CDATA[ $numbers = range (1,20); srand ((float)microtime()*1000000); shuffle ($numbers); while (list (, $number) = each ($numbers)) { echo "$number "; } +]]> </programlisting> </example> </para> @@ -3210,7 +3346,8 @@ <example> <title><function>sort</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $fruits = array ("lemon", "orange", "banana", "apple"); sort ($fruits); @@ -3219,7 +3356,8 @@ echo "fruits[".$key."] = ".$val."\n"; } -?&gt; +?> +]]> </programlisting> </example> </para> @@ -3229,10 +3367,12 @@ <para> <informalexample> <programlisting> +<![CDATA[ fruits[0] = apple fruits[1] = banana fruits[2] = lemon fruits[3] = orange +]]> </programlisting> </informalexample> </para> @@ -3339,18 +3479,20 @@ <example> <title><function>uksort</function> example</title> <programlisting role="php"> +<![CDATA[ function cmp ($a, $b) { if ($a == $b) return 0; return ($a > $b) ? -1 : 1; } -$a = array (4 =&gt; "four", 3 =&gt; "three", 20 =&gt; "twenty", 10 =&gt; "ten"); +$a = array (4 => "four", 3 => "three", 20 => "twenty", 10 => "ten"); uksort ($a, "cmp"); while (list ($key, $value) = each ($a)) { echo "$key: $value\n"; } +]]> </programlisting> </example> </para> @@ -3360,10 +3502,12 @@ <para> <informalexample> <programlisting> +<![CDATA[ 20: twenty 10: ten 4: four 3: three +]]> </programlisting> </informalexample> </para> @@ -3409,9 +3553,10 @@ <example> <title><function>usort</function> example</title> <programlisting role="php"> +<![CDATA[ function cmp ($a, $b) { if ($a == $b) return 0; - return ($a &lt; $b) ? -1 : 1; + return ($a > $b) ? -1 : 1; } $a = array (3, 2, 5, 6, 1); @@ -3421,6 +3566,7 @@ while (list ($key, $value) = each ($a)) { echo "$key: $value\n"; } +]]> </programlisting> </example> </para> @@ -3430,11 +3576,13 @@ <para> <informalexample> <programlisting> +<![CDATA[ 0: 6 1: 5 2: 3 3: 2 4: 1 +]]> </programlisting> </informalexample> </para> @@ -3450,6 +3598,7 @@ <function>usort</function> example using multi-dimensional array </title> <programlisting role="php"> +<![CDATA[ function cmp ($a, $b) { return strcmp($a["fruit"], $b["fruit"]); } @@ -3463,6 +3612,7 @@ while (list ($key, $value) = each ($fruits)) { echo "\$fruits[$key]: " . $value["fruit"] . "\n"; } +]]> </programlisting> </example> </para> @@ -3476,9 +3626,11 @@ <para> <informalexample> <programlisting> +<![CDATA[ $fruits[0]: apples $fruits[1]: grapes $fruits[2]: lemons +]]> </programlisting> </informalexample> </para> Index: phpdoc/en/functions/aspell.xml diff -u phpdoc/en/functions/aspell.xml:1.17 phpdoc/en/functions/aspell.xml:1.18 --- phpdoc/en/functions/aspell.xml:1.17 Sat Nov 10 16:49:32 2001 +++ phpdoc/en/functions/aspell.xml Sat Nov 17 22:07:16 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.17 $ --> +<!-- $Revision: 1.18 $ --> <reference id="ref.aspell"> <title>Aspell functions [deprecated]</title> <titleabbrev>Aspell</titleabbrev> @@ -50,7 +50,9 @@ <example> <title><function>aspell_new</function></title> <programlisting role="php"> +<![CDATA[ $aspell_link = aspell_new("english"); +]]> </programlisting> </example> </para> @@ -79,6 +81,7 @@ <example> <title><function>aspell_check</function></title> <programlisting> +<![CDATA[ $aspell_link = aspell_new("english"); if (aspell_check($aspell_link, "testt")) { @@ -86,6 +89,7 @@ } else { echo "Sorry, wrong spelling"; } +]]> </programlisting> </example> </para> @@ -117,6 +121,7 @@ <example> <title><function>aspell_check_raw</function></title> <programlisting role="php"> +<![CDATA[ $aspell_link = aspell_new("english"); if (aspell_check_raw($aspell_link, "test")) { @@ -124,6 +129,7 @@ } else { echo "Sorry, wrong spelling"; } +]]> </programlisting> </example> </para> @@ -152,15 +158,17 @@ <example> <title><function>aspell_suggest</function></title> <programlisting role="php"> +<![CDATA[ $aspell_link = aspell_new("english"); if (!aspell_check($aspell_link, "test")) { $suggestions = aspell_suggest($aspell_link, "test"); foreach ($suggestions as $suggestion) { - echo "Possible spelling: $suggestion&lt;br>\n"; + echo "Possible spelling: $suggestion<br>\n"; } } +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/bzip2.xml diff -u phpdoc/en/functions/bzip2.xml:1.11 phpdoc/en/functions/bzip2.xml:1.12 --- phpdoc/en/functions/bzip2.xml:1.11 Sat Nov 10 16:49:32 2001 +++ phpdoc/en/functions/bzip2.xml Sat Nov 17 22:07:16 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <reference id="ref.bzip2"> <title>Bzip2 Compression Functions</title> <titleabbrev>Bzip2</titleabbrev> @@ -25,7 +25,8 @@ <example> <title>Small bzip2 Example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $filename = "/tmp/testfile.bz2"; $str = "This is a test string.\n"; @@ -51,6 +52,7 @@ bzclose($bz); ?> +]]> </programlisting> </example> </sect1> @@ -129,11 +131,14 @@ <para> <example> <title><function>bzcompress</function> Example</title> - <programlisting role="php">&lt;?php + <programlisting role="php"> +<![CDATA[ +<?php $str = "sample data"; $bzstr = bzcompress($str, 9); print( $bzstr ); ?> +]]> </programlisting> </example> </para> @@ -173,19 +178,22 @@ <para> <example> <title><function>bzdecompress</function></title> - <programlisting role="php">&lt;?php + <programlisting role="php"> +<![CDATA[ +<?php $start_str = "This is not an honest face?"; $bzstr = bzcompress($start_str); print( "Compressed String: " ); print( $bzstr ); -print( "\n&lt;br&gt;n" ); +print( "\n<br>\n" ); $str = bzdecompress($bzstr); print( "Decompressed String: " ); print( $str ); -print( "\n&lt;br&gt;n" ); +print( "\n<br>\n" ); ?> +]]> </programlisting> </example> </para> @@ -241,12 +249,15 @@ <para> <example> <title><function>bzerror</function> Example</title> - <programlisting role="php">&lt;?php + <programlisting role="php"> +<![CDATA[ +<?php $error = bzerror($bz); echo $error["errno"]; echo $error["errstr"]; ?> +]]> </programlisting> </example> </para> @@ -335,15 +346,18 @@ <para> <example> <title><function>bzopen</function> Example</title> - <programlisting role="php">&lt;?php + <programlisting role="php"> +<![CDATA[ +<?php $bz = bzopen("/tmp/foo.bz2", "r"); $decompressed_file = bzread($bz, filesize("/tmp/foo.bz2")); bzclose($bz); print( "The contents of /tmp/foo.bz2 are: " ); -print( "\n&lt;br&gt;n" ); +print( "\n<br>\n" ); print( $decompressed_file ); ?> +]]> </programlisting> </example> </para> @@ -383,11 +397,14 @@ <para> <example> <title><function>bzread</function> Example</title> - <programlisting role="php">&lt;?php + <programlisting role="php"> +<![CDATA[ +<?php $bz = bzopen("/tmp/foo.bz2", "r"); $str = bzread($bz, 2048); print( $str ); ?> +]]> </programlisting> </example> </para> @@ -426,12 +443,15 @@ <para> <example> <title><function>bzwrite</function> Example</title> - <programlisting role="php">&lt;?php + <programlisting role="php"> +<![CDATA[ +<?php $str = "uncompressed data"; $bz = bzopen("/tmp/foo.bz2", "w"); bzwrite($bz, $str, strlen($str)); bzclose($bz); ?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/calendar.xml diff -u phpdoc/en/functions/calendar.xml:1.16 phpdoc/en/functions/calendar.xml:1.17 --- phpdoc/en/functions/calendar.xml:1.16 Sat Nov 10 16:49:32 2001 +++ phpdoc/en/functions/calendar.xml Sat Nov 17 22:07:16 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <reference id="ref.calendar"> <title>Calendar functions</title> <titleabbrev>Calendar</titleabbrev> @@ -76,12 +76,14 @@ <example> <title>Calendar functions</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $jd = GregorianToJD (10,11,1970); echo "$jd\n"; $gregorian = JDToGregorian ($jd); echo "$gregorian\n"; ?> +]]> </programlisting> </example> </para> @@ -385,9 +387,11 @@ <example> <title><function>easter_date</function> example</title> <programlisting role="php"> +<![CDATA[ echo date ("M-d-Y", easter_date(1999)); /* "Apr-04-1999" */ echo date ("M-d-Y", easter_date(2000)); /* "Apr-23-2000" */ echo date ("M-d-Y", easter_date(2001)); /* "Apr-15-2001" */ +]]> </programlisting> </example> </para> @@ -446,9 +450,11 @@ <example> <title><function>easter_days</function> example</title> <programlisting role="php"> +<![CDATA[ echo easter_days (1999); /* 14, i.e. April 4 */ echo easter_days (1492); /* 32, i.e. April 22 */ echo easter_days (1913); /* 2, i.e. March 23 */ +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/classobj.xml diff -u phpdoc/en/functions/classobj.xml:1.26 phpdoc/en/functions/classobj.xml:1.27 --- phpdoc/en/functions/classobj.xml:1.26 Sat Nov 10 16:49:32 2001 +++ phpdoc/en/functions/classobj.xml Sat Nov 17 22:07:16 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.26 $ --> +<!-- $Revision: 1.27 $ --> <reference id="ref.classobj"> <title>Class/Object Functions</title> <titleabbrev>Classes/Objects</titleabbrev> @@ -31,7 +31,8 @@ <example> <title>classes.inc</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // base class with member properties and methods class Vegetable { @@ -39,17 +40,17 @@ var $edible; var $color; - function Vegetable( $edible, $color=&quot;green&quot; ) { - $this-&gt;edible = $edible; - $this-&gt;color = $color; + function Vegetable( $edible, $color="green" ) { + $this->edible = $edible; + $this->color = $color; } function is_edible() { - return $this-&gt;edible; + return $this->edible; } function what_color() { - return $this-&gt;color; + return $this->color; } } // end of class Vegetable @@ -61,20 +62,21 @@ var $cooked = false; function Spinach() { - $this-&gt;Vegetable( true, &quot;green&quot; ); + $this->Vegetable( true, "green" ); } function cook_it() { - $this-&gt;cooked = true; + $this->cooked = true; } function is_cooked() { - return $this-&gt;cooked; + return $this->cooked; } } // end of class Spinach -?&gt; +?> +]]> </programlisting> </example> </para> @@ -88,58 +90,60 @@ <example> <title>test_script.php</title> <programlisting role="php"> -&lt;pre&gt; -&lt;?php +<![CDATA[ +<pre> +<?php -include &quot;classes.inc&quot;; +include "classes.inc"; // utility functions function print_vars($obj) { $arr = get_object_vars($obj); while (list($prop, $val) = each($arr)) - echo &quot;\t$prop = $val\n&quot;; + echo "\t$prop = $val\n"; } function print_methods($obj) { $arr = get_class_methods(get_class($obj)); foreach ($arr as $method) - echo &quot;\tfunction $method()\n&quot;; + echo "\tfunction $method()\n"; } function class_parentage($obj, $class) { global $$obj; if (is_subclass_of($$obj, $class)) { - echo &quot;Object $obj belongs to class &quot;.get_class($$obj); - echo &quot; a subclass of $class\n&quot;; + echo "Object $obj belongs to class ".get_class($$obj); + echo " a subclass of $class\n"; } else { - echo &quot;Object $obj does not belong to a subclass of $class\n&quot;; + echo "Object $obj does not belong to a subclass of $class\n"; } } // instantiate 2 objects -$veggie = new Vegetable(true,&quot;blue&quot;); +$veggie = new Vegetable(true,"blue"); $leafy = new Spinach(); // print out information about objects -echo &quot;veggie: CLASS &quot;.get_class($veggie).&quot;\n&quot;; -echo &quot;leafy: CLASS &quot;.get_class($leafy); -echo &quot;, PARENT &quot;.get_parent_class($leafy).&quot;\n&quot;; +echo "veggie: CLASS ".get_class($veggie)."\n"; +echo "leafy: CLASS ".get_class($leafy); +echo ", PARENT ".get_parent_class($leafy)."\n"; // show veggie properties -echo &quot;\nveggie: Properties\n&quot;; +echo "\nveggie: Properties\n"; print_vars($veggie); // and leafy methods -echo &quot;\nleafy: Methods\n&quot;; +echo "\nleafy: Methods\n"; print_methods($leafy); -echo &quot;\nParentage:\n&quot;; -class_parentage(&quot;leafy&quot;, &quot;Spinach&quot;); -class_parentage(&quot;leafy&quot;, &quot;Vegetable&quot;); -?&gt; -&lt;/pre&gt; +echo "\nParentage:\n"; +class_parentage("leafy", "Spinach"); +class_parentage("leafy", "Vegetable"); +?> +</pre> +]]> </programlisting> </example> </para> @@ -153,10 +157,12 @@ <para> <informalexample> <programlisting> +<![CDATA[ [...] Parentage: Object leafy does not belong to a subclass of Spinach Object leafy belongs to class spinach a subclass of Vegetable +]]> </programlisting> </informalexample> </para> @@ -244,30 +250,32 @@ <varname>print_info</varname> method. <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php class Country { var $NAME; var $TLD; function Country($name, $tld) { - $this-&gt;NAME = $name; - $this-&gt;TLD = $tld; + $this->NAME = $name; + $this->TLD = $tld; } - function print_info($prestr=&quot;&quot;) { - echo $prestr.&quot;Country: &quot;.$this-&gt;NAME.&quot;\n&quot;; - echo $prestr.&quot;Top Level Domain: &quot;.$this-&gt;TLD.&quot;\n&quot;; + function print_info($prestr="") { + echo $prestr."Country: ".$this->NAME."\n"; + echo $prestr."Top Level Domain: ".$this->TLD."\n"; } } -$cntry = new Country(&quot;Peru&quot;,&quot;pe&quot;); +$cntry = new Country("Peru","pe"); -echo &quot;* Calling the object method directly\n&quot;; -$cntry-&gt;print_info(); +echo "* Calling the object method directly\n"; +$cntry->print_info(); -echo &quot;\n* Calling the same method indirectly\n&quot;; -call_user_method (&quot;print_info&quot;, $cntry, &quot;\t&quot;); -?&gt; +echo "\n* Calling the same method indirectly\n"; +call_user_method ("print_info", $cntry, "\t"); +?> +]]> </programlisting> </informalexample> </para> @@ -353,7 +361,9 @@ <parameter>class_name</parameter>. For example: <informalexample> <programlisting> +<![CDATA[ $class_methods = get_class_methods($my_class); +]]> </programlisting> </informalexample> </para> @@ -362,7 +372,8 @@ <example> <title><function>get_class_methods</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php class myclass { // constructor @@ -389,7 +400,8 @@ echo "$method_name\n"; } -?&gt; +?> +]]> </programlisting> </example> </para> @@ -397,9 +409,11 @@ Will produce: <informalexample> <programlisting> +<![CDATA[ myclass myfunc1 myfunc2 +]]> </programlisting> </informalexample> </para> @@ -440,7 +454,8 @@ <example> <title><function>get_class_vars</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php class myclass { @@ -463,7 +478,8 @@ echo "$name : $value\n"; } -?&gt; +?> +]]> </programlisting> </example> </para> @@ -471,8 +487,10 @@ Will produce: <informalexample> <programlisting> +<![CDATA[ var2 : xyz var3 : 100 +]]> </programlisting> </informalexample> </para> @@ -540,24 +558,25 @@ <example> <title>Use of <function>get_object_vars</function></title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php class Point2D { var $x, $y; var $label; function Point2D($x, $y) { - $this-&gt;x = $x; - $this-&gt;y = $y; + $this->x = $x; + $this->y = $y; } function setLabel($label) { - $this-&gt;label = $label; + $this->label = $label; } function getPoint() { - return array("x" =&gt; $this-&gt;x, - "y" =&gt; $this-&gt;y, - "label" =&gt; $this-&gt;label); + return array("x" => $this->x, + "y" => $this->y, + "label" => $this->label); } } @@ -566,20 +585,21 @@ // "$label" is declared but not defined // Array // ( -// [x] =&gt; 1.233 -// [y] =&gt; 3.445 +// [x] => 1.233 +// [y] => 3.445 // ) -$p1-&gt;setLabel("point #1"); +$p1->setLabel("point #1"); print_r(get_object_vars($p1)); // Array // ( -// [x] =&gt; 1.233 -// [y] =&gt; 3.445 -// [label] =&gt; point #1 +// [x] => 1.233 +// [y] => 3.445 +// [label] => point #1 // ) -?&gt; +?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/com.xml diff -u phpdoc/en/functions/com.xml:1.24 phpdoc/en/functions/com.xml:1.25 --- phpdoc/en/functions/com.xml:1.24 Tue Nov 13 19:30:56 2001 +++ phpdoc/en/functions/com.xml Sat Nov 17 22:07:16 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.24 $ --> +<!-- $Revision: 1.25 $ --> <reference id="ref.com"> <title>COM support functions for Windows</title> <titleabbrev>COM</titleabbrev> @@ -85,6 +85,7 @@ <example id="example.com1"> <title>COM example (1)</title> <programlisting role="php"> +<![CDATA[ // starting word $word = new COM("word.application") or die("Unable to instanciate Word"); print "Loaded Word, version {$word->Version}\n"; @@ -105,6 +106,7 @@ //free the object $word->Release(); $word = null; +]]> </programlisting> </example> </para> @@ -112,6 +114,7 @@ <example id="example.com2"> <title>COM example (2)</title> <programlisting role="php"> +<![CDATA[ $conn = new COM("ADODB.Connection") or die("Cannot start ADO"); $conn->Open("Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=database; User ID=user; Password=password"); @@ -121,7 +124,7 @@ $num_columns = $rs->Fields->Count(); echo $num_columns . "\n"; -for ($i=0; $i &lt; $num_columns; $i++) +for ($i=0; $i < $num_columns; $i++) { $fld[$i] = $rs->Fields($i); } @@ -129,7 +132,7 @@ $rowcount = 0; while (!$rs->EOF) { - for ($i=0; $i &lt; $num_columns; $i++) + for ($i=0; $i < $num_columns; $i++) { echo $fld[$i]->value . "\t"; } @@ -146,6 +149,7 @@ $rs = null; $conn = null; +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/cpdf.xml diff -u phpdoc/en/functions/cpdf.xml:1.32 phpdoc/en/functions/cpdf.xml:1.33 --- phpdoc/en/functions/cpdf.xml:1.32 Sat Nov 10 16:49:32 2001 +++ phpdoc/en/functions/cpdf.xml Sat Nov 17 22:07:16 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.32 $ --> +<!-- $Revision: 1.33 $ --> <reference id="ref.cpdf"> <title>ClibPDF functions</title> <titleabbrev>ClibPDF</titleabbrev> @@ -63,7 +63,8 @@ <example> <title>Simple ClibPDF Example</title> <programlisting> -&lt;?php +<![CDATA[ +<?php $cpdf = cpdf_open(0); cpdf_page_init($cpdf, 1, 0, 595, 842); cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1"); @@ -79,7 +80,8 @@ Header("Content-type: application/pdf"); cpdf_output_buffer($cpdf); cpdf_close($cpdf); -?&gt; +?> +]]> </programlisting> </example> <simpara> @@ -90,7 +92,8 @@ <example> <title>pdfclock example from pdflib 2.0 distribution</title> <programlisting> -&lt;?php +<![CDATA[ +<?php $radius = 200; $margin = 20; $pagecount = 40; @@ -176,7 +179,8 @@ Header("Content-type: application/pdf"); cpdf_output_buffer($pdf); cpdf_close($pdf); -?&gt; +?> +]]> </programlisting> </example> </partintro> @@ -238,7 +242,8 @@ <example> <title>Adding a page outline</title> <programlisting> -&lt;?php +<![CDATA[ +<?php $cpdf = cpdf_open(0); cpdf_page_init($cpdf, 1, 0, 595, 842); cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1"); @@ -249,7 +254,8 @@ Header("Content-type: application/pdf"); cpdf_output_buffer($cpdf); cpdf_close($cpdf); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -314,12 +320,14 @@ <example> <title>Text output</title> <programlisting> -&lt;?php +<![CDATA[ +<?php cpdf_begin_text($pdf); cpdf_set_font($pdf, 16, "Helvetica", "WinAnsiEncoding"); cpdf_text($pdf, 100, 100, "Some text"); cpdf_end_text($pdf) -?&gt; +?> +]]> </programlisting> </example> </para> @@ -573,12 +581,14 @@ <example> <title>Text output</title> <programlisting> -&lt;?php +<![CDATA[ +<?php cpdf_begin_text($pdf); cpdf_set_font($pdf, 16, "Helvetica", "WinAnsiEncoding"); cpdf_text($pdf, 100, 100, "Some text"); cpdf_end_text($pdf) -?&gt; +?> +]]> </programlisting> </example> </para> @@ -1069,11 +1079,13 @@ <example> <title>Save/Restore</title> <programlisting> -&lt;?php +<![CDATA[ +<?php cpdf_save($pdf); // do all kinds of rotations, transformations, ... cpdf_restore($pdf) -?&gt; +?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/curl.xml diff -u phpdoc/en/functions/curl.xml:1.17 phpdoc/en/functions/curl.xml:1.18 --- phpdoc/en/functions/curl.xml:1.17 Sat Nov 10 16:49:32 2001 +++ phpdoc/en/functions/curl.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.17 $ --> +<!-- $Revision: 1.18 $ --> <reference id="ref.curl"> <title>CURL, Client URL Library Functions</title> <titleabbrev>CURL</titleabbrev> @@ -45,7 +45,8 @@ <example> <title>Using PHP's CURL module to fetch the PHP homepage</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $ch = curl_init ("http://www.php.net/"); $fp = fopen ("php_homepage.txt", "w"); @@ -57,6 +58,7 @@ curl_close ($ch); fclose ($fp); ?> +]]> </programlisting> </example> </para> @@ -95,7 +97,8 @@ Initializing a new CURL session and fetching a webpage </title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, "http://www.zend.com/"); @@ -105,6 +108,7 @@ curl_close ($ch); ?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/cybermut.xml diff -u phpdoc/en/functions/cybermut.xml:1.9 phpdoc/en/functions/cybermut.xml:1.10 --- phpdoc/en/functions/cybermut.xml:1.9 Sat Nov 10 16:49:33 2001 +++ phpdoc/en/functions/cybermut.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <reference id="ref.cybermut"> <title>Cr&eacute;dit Mutuel CyberMUT functions</title> <titleabbrev>CyberMUT</titleabbrev> @@ -73,7 +73,8 @@ <example> <title>First step of payment (equiv cgi1.c)</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // Directory where are located the keys putenv("CMKEYDIR=/var/creditmut/cles"); @@ -95,7 +96,8 @@ "Paiement par carte bancaire"); echo $retour; -?&gt; +?> +]]> </programlisting> </example> <para> @@ -135,16 +137,19 @@ Pay attention to parameters code-retour and texte-libre, which cannot be evaluated as is, because auf the dash. You must retrieve them by using: <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $code_retour=$HTTP_GET_VARS["code-retour"]; $texte_libre=$HTTP_GET_VARS["texte-libre"]; -?&gt; +?> +]]> </programlisting> </para> <example> <title>Last step of payment (equiv cgi2.c)</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // Make sure that Enable Track Vars is ON. // Directory where are located the keys putenv("CMKEYDIR=/var/creditmut/cles"); @@ -165,10 +170,12 @@ // $result=creditmut_creerreponsecm("OK"); - } else { - $result=creditmut_creerreponsecm("Document Falsifie");} +} else { + $result=creditmut_creerreponsecm("Document Falsifie"); +} -?&gt; +?> +]]> </programlisting> </example> <para> Index: phpdoc/en/functions/datetime.xml diff -u phpdoc/en/functions/datetime.xml:1.51 phpdoc/en/functions/datetime.xml:1.52 --- phpdoc/en/functions/datetime.xml:1.51 Sat Nov 10 16:49:33 2001 +++ phpdoc/en/functions/datetime.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.51 $ --> +<!-- $Revision: 1.52 $ --> <reference id="ref.datetime"> <title>Date and Time functions</title> <titleabbrev>Date/time</titleabbrev> @@ -254,8 +254,10 @@ <example> <title><function>date</function> example</title> <programlisting role="php"> +<![CDATA[ echo date ("l dS of F Y h:i:s A"); echo "July 1, 2000 is on a " . date ("l", mktime(0,0,0,7,1,2000)); +]]> </programlisting> </example> </para> @@ -267,7 +269,9 @@ <example> <title>Escaping characters in <function>date</function></title> <programlisting role="php"> +<![CDATA[ echo date("l \\t\h\e jS"); // prints something like 'Saturday the 8th' +]]> </programlisting> </example> </para> @@ -280,10 +284,12 @@ <function>date</function> and <function>mktime</function> example </title> - <programlisting> + <programlisting role="php"> +<![CDATA[ $tomorrow = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); $lastmonth = mktime (0,0,0,date("m")-1,date("d"), date("Y")); $nextyear = mktime (0,0,0,date("m"), date("d"), date("Y")+1); +]]> </programlisting> </example> <note> @@ -305,7 +311,8 @@ <title> <function>date</function> Formatting </title> - <programlisting> + <programlisting role="php"> +<![CDATA[ /* Today is March 10th, 2001, 5:16:18 pm */ $today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm $today = date("m.d.y"); // 03.10.01 @@ -316,6 +323,7 @@ $today = date("D M j G:i:s T Y"); // Sat Mar 10 15:16:08 MST 2001 $today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:17 m is month $today = date("H:i:s"); // 17:16:17 +]]> </programlisting> </example> </para> @@ -408,12 +416,14 @@ <title> <function>getdate</function> example </title> - <programlisting> + <programlisting role="php"> +<![CDATA[ $today = getdate(); $month = $today['month']; $mday = $today['mday']; $year = $today['year']; echo "$month $mday, $year"; +]]> </programlisting> </example> </para> @@ -487,8 +497,10 @@ <example> <title><function>gmdate</function> example</title> <programlisting role="php"> +<![CDATA[ echo date ("M d Y H:i:s", mktime (0,0,0,1,1,1998)); echo gmdate ("M d Y H:i:s", mktime (0,0,0,1,1,1998)); +]]> </programlisting> </example> </para> @@ -554,9 +566,11 @@ <example> <title><function>gmstrftime</function> example</title> <programlisting role="php"> +<![CDATA[ setlocale ('LC_TIME', 'en_US'); echo strftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; echo gmstrftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; +]]> </programlisting> </example> </para> @@ -678,6 +692,7 @@ <example> <title><function>microtime</function> example</title> <programlisting role="php"> +<![CDATA[ function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); @@ -685,7 +700,7 @@ $time_start = getmicrotime(); -for ($i=0; $i &lt; 1000; $i++){ +for ($i=0; $i < 1000; $i++){ //do nothing, 1000 times } @@ -693,6 +708,7 @@ $time = $time_end - $time_start; echo "Did nothing in $time seconds"; +]]> </programlisting> </example> </para> @@ -759,11 +775,13 @@ lines produces the string "Jan-01-1998". <example> <title><function>mktime</function> example</title> - <programlisting> + <programlisting role="php"> +<![CDATA[ echo date ("M-d-Y", mktime (0,0,0,12,32,1997)); echo date ("M-d-Y", mktime (0,0,0,13,1,1997)); echo date ("M-d-Y", mktime (0,0,0,1,1,1998)); echo date ("M-d-Y", mktime (0,0,0,1,1,98)); +]]> </programlisting> </example> <parameter>Year</parameter> may be a two or four digit value, @@ -779,11 +797,13 @@ <example> <title>Last day of next month</title> <programlisting role="php"> +<![CDATA[ $lastday = mktime (0,0,0,3,0,2000); echo strftime ("Last day in Feb 2000 is: %d", $lastday); $lastday = mktime (0,0,0,4,-31,2000); echo strftime ("Last day in Feb 2000 is: %d", $lastday); +]]> </programlisting> </example> </para> @@ -1022,6 +1042,7 @@ <example> <title><function>strftime</function> example</title> <programlisting role="php"> +<![CDATA[ setlocale ("LC_TIME", "C"); print (strftime ("%A in Finnish is ")); setlocale ("LC_TIME", "fi_FI"); @@ -1030,6 +1051,7 @@ print (strftime ("%A and in German ")); setlocale ("LC_TIME", "de_DE"); print (strftime ("%A.\n")); +]]> </programlisting> </example> This example works if you have the respective locales installed @@ -1093,11 +1115,13 @@ <example> <title><function>strtotime</function> examples</title> <programlisting role="php"> +<![CDATA[ echo strtotime ("now") . "\n"; echo strtotime ("10 September 2000") . "\n"; echo strtotime ("+1 day") . "\n"; echo strtotime ("+1 week") . "\n"; echo strtotime ("+1 week 2 days 4 hours 2 seconds") . "\n"; +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/dba.xml diff -u phpdoc/en/functions/dba.xml:1.16 phpdoc/en/functions/dba.xml:1.17 --- phpdoc/en/functions/dba.xml:1.16 Sat Nov 10 16:49:33 2001 +++ phpdoc/en/functions/dba.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <reference id="ref.dba"> <title>Database (dbm-style) abstraction layer functions</title> <titleabbrev>dba</titleabbrev> @@ -106,7 +106,8 @@ <example> <title>DBA example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $id = dba_open ("/tmp/test.db", "n", "db2"); @@ -123,7 +124,8 @@ } dba_close ($id); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -147,7 +149,8 @@ <example> <title>Traversing a database</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php # ...open database... @@ -160,10 +163,11 @@ $key = dba_nextkey ($id); } -for ($i = 0; $i &lt; count($handle_later); $i++) +for ($i = 0; $i < count($handle_later); $i++) dba_delete ($handle_later[$i], $id); -?&gt; +?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/dbase.xml diff -u phpdoc/en/functions/dbase.xml:1.12 phpdoc/en/functions/dbase.xml:1.13 --- phpdoc/en/functions/dbase.xml:1.12 Sat Nov 10 16:49:33 2001 +++ phpdoc/en/functions/dbase.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <reference id="ref.dbase"> <title>dBase functions</title> <titleabbrev>dBase</titleabbrev> @@ -104,6 +104,7 @@ <example> <title>Creating a dBase database file</title> <programlisting role="php"> +<![CDATA[ // "database" name $dbname = "/tmp/test.dbf"; @@ -119,7 +120,8 @@ // creation if (!dbase_create($dbname, $def)) - print "&lt;strong>Error!&lt;/strong>"; + print "<strong>Error!</strong>"; +]]> </programlisting> </example> </para> @@ -351,11 +353,13 @@ <example> <title>Using <function>dbase_numfields</function></title> <programlisting role="php"> +<![CDATA[ $rec = dbase_get_record($db, $recno); $nf = dbase_numfields($db); -for ($i=0; $i &lt; $nf; $i++) { - print $rec[$i]."&lt;br>\n"; +for ($i=0; $i < $nf; $i++) { + print $rec[$i]."<br>\n"; } +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/dbm.xml diff -u phpdoc/en/functions/dbm.xml:1.13 phpdoc/en/functions/dbm.xml:1.14 --- phpdoc/en/functions/dbm.xml:1.13 Sat Nov 10 16:49:33 2001 +++ phpdoc/en/functions/dbm.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <reference id="ref.dbm"> <title>DBM Functions</title> <titleabbrev>DBM</titleabbrev> @@ -16,6 +16,7 @@ <example> <title>DBM example</title> <programlisting role="php"> +<![CDATA[ $dbm = dbmopen ("lastseen", "w"); if (dbmexists ($dbm, $userid)) { $last_seen = dbmfetch ($dbm, $userid); @@ -25,6 +26,7 @@ do_stuff(); dbmreplace ($dbm, $userid, time()); dbmclose ($dbm); +]]> </programlisting> </example> </para> @@ -263,11 +265,13 @@ <example> <title>Visiting every key/value pair in a DBM database</title> <programlisting role="php"> +<![CDATA[ $key = dbmfirstkey ($dbm_id); while ($key) { echo "$key = " . dbmfetch ($dbm_id, $key) . "\n"; $key = dbmnextkey ($dbm_id, $key); } +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/dbx.xml diff -u phpdoc/en/functions/dbx.xml:1.20 phpdoc/en/functions/dbx.xml:1.21 --- phpdoc/en/functions/dbx.xml:1.20 Sat Nov 10 16:49:33 2001 +++ phpdoc/en/functions/dbx.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.20 $ --> +<!-- $Revision: 1.21 $ --> <reference id="ref.dbx"> <title>dbx functions</title> <titleabbrev>dbx</titleabbrev> @@ -53,12 +53,14 @@ <example> <title><function>dbx_close</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = dbx_connect ("mysql", "localhost", "db", "username", "password") or die ("Could not connect"); print("Connected successfully"); dbx_close($link); -?&gt; +?> +]]> </programlisting> </example> <note> @@ -146,10 +148,12 @@ <para> <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = dbx_connect ("mysql", "localhost", "db", "username", "password"); mysql_close ($link->handle); // dbx_close($link) would be better here -?&gt; +?> +]]> </programlisting> </informalexample> </para> @@ -162,12 +166,14 @@ <example> <title><function>dbx_connect</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = dbx_connect ("odbc", "", "db", "username", "password", DBX_PERSISTENT) or die ("Could not connect"); print ("Connected successfully"); dbx_close ($link); -?&gt; +?> +]]> </programlisting> </example> <note> @@ -212,7 +218,8 @@ <example> <title><function>dbx_error</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = dbx_connect ("mysql", "localhost", "db", "username", "password") or die ("Could not connect"); $result = dbx_query ($link, "select id from nonexistingtbl"); @@ -220,7 +227,8 @@ echo dbx_error ($link); } dbx_close ($link); -?&gt; +?> +]]> </programlisting> </example> <note> @@ -292,8 +300,10 @@ <para> <informalexample role="php"> <programlisting> +<![CDATA[ $result = dbx_query ($link, "SELECT id FROM tbl"); mysql_field_len ($result->handle, 0); +]]> </programlisting> </informalexample> </para> @@ -304,8 +314,10 @@ <para> <informalexample> <programlisting role="php"> +<![CDATA[ $result = dbx_query ($link, "SELECT id FROM tbl"); -echo "result size: " . $result->rows . " x " . $result->cols . "&lt;br>\n"; +echo "result size: " . $result->rows . " x " . $result->cols . "<br>\n"; +]]> </programlisting> </informalexample> </para> @@ -318,9 +330,11 @@ <para> <informalexample> <programlisting role="php"> +<![CDATA[ $result = dbx_query ($link, "SELECT id FROM tbl"); -echo "column name: " . $result->info["name"][0] . "&lt;br>\n"; -echo "column type: " . $result->info["type"][0] . "&lt;br>\n"; +echo "column name: " . $result->info["name"][0] . "<br>\n"; +echo "column type: " . $result->info["type"][0] . "<br>\n"; +]]> </programlisting> </informalexample> </para> @@ -333,42 +347,44 @@ <example> <title><function>dbx_query</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = dbx_connect ("odbc", "", "db", "username", "password") or die ("Could not connect"); $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl"); -if ($result==0) echo "Query failed\n&lt;br>"; +if ($result==0) echo "Query failed\n<br>"; elseif ($result==1) { - echo "Query executed successfully\n&lt;br>"; + echo "Query executed successfully\n<br>"; } else { $rows=$result->rows; $cols=$result->cols; - echo "&lt;p>table dimension: {$result->rows} x {$result->cols}&lt;br>&lt;table border=1>\n"; - echo "&lt;tr>"; - for ($col=0; $col&lt;$cols; ++$col) { - echo "&lt;td>-{$result->info["name"][$col]}-&lt;br>-{$result->info["type"][$col]}-&lt;/td>"; + echo "<p>table dimension: {$result->rows} x {$result->cols}<br><table border=1>\n"; + echo "<tr>"; + for ($col=0; $col<$cols; ++$col) { + echo "<td>-{$result->info["name"][$col]}-<br>-{$result->info["type"][$col]}-</td>"; } - echo "&lt;/tr>\n"; - for ($row=0; $row&lt;$rows; ++$row){ - echo "&lt;tr>"; - for ($col=0; $col&lt;$cols; ++$col) { - echo "&lt;td>-{$result->data[$row][$col]}-&lt;/td>"; + echo "</tr>\n"; + for ($row=0; $row<$rows; ++$row){ + echo "<tr>"; + for ($col=0; $col<$cols; ++$col) { + echo "<td>-{$result->data[$row][$col]}-</td>"; } - echo "&lt;/tr>\n"; + echo "</tr>\n"; } - echo "&lt;/table>&lt;p>\n"; - echo "table dimension: {$result->rows} x id, parentid, description&lt;br>&lt;table border=1>\n"; - for ($row=0; $row&lt;$rows; ++$row) { - echo "&lt;tr>"; - echo "&lt;td>-{$result->data[$row]["id"]}-&lt;/td>"; - echo "&lt;td>-{$result->data[$row]["parentid"]}-&lt;/td>"; - echo "&lt;td>-{$result->data[$row]["description"]}-&lt;/td>"; - echo "&lt;/tr>\n"; + echo "</table><p>\n"; + echo "table dimension: {$result->rows} x id, parentid, description<br><table border=1>\n"; + for ($row=0; $row<$rows; ++$row) { + echo "<tr>"; + echo "<td>-{$result->data[$row]["id"]}-</td>"; + echo "<td>-{$result->data[$row]["parentid"]}-</td>"; + echo "<td>-{$result->data[$row]["description"]}-</td>"; + echo "</tr>\n"; } - echo "&lt;/table>&lt;p>\n"; + echo "</table><p>\n"; } dbx_close($link); -?&gt; +?> +]]> </programlisting> </example> <note> @@ -408,7 +424,8 @@ <example> <title><function>dbx_sort</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function user_re_order ($a, $b) { $rv = dbx_compare ($a, $b, "parentid", DBX_CMP_DESC); if (!$rv) $rv = dbx_compare ($a, $b, "id"); @@ -418,11 +435,12 @@ $link = dbx_connect ("odbc", "", "db", "username", "password") or die ("Could not connect"); $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl ORDER BY id"); -echo "resulting data is now ordered by id&lt;br>"; +echo "resulting data is now ordered by id<br>"; dbx_sort ($result, "user_re_order"); -echo "resulting data is now ordered by parentid (descending), then by id&lt;br>"; +echo "resulting data is now ordered by parentid (descending), then by id<br>"; dbx_close ($link); -?&gt; +?> +]]> </programlisting> </example> <para> @@ -469,7 +487,8 @@ <example> <title><function>dbx_compare</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function user_re_order ($a, $b) { $rv = dbx_compare ($a, $b, "parentid", DBX_CMP_DESC); if (!$rv) { @@ -481,11 +500,12 @@ $link = dbx_connect ("odbc", "", "db", "username", "password") or die ("Could not connect"); $result = dbx_query ($link, "SELECT id, parentid, description FROM tbl ORDER BY id"); -echo "resulting data is now ordered by id&lt;br>"; +echo "resulting data is now ordered by id<br>"; dbx_sort ($result, "user_re_order"); -echo "resulting data is now ordered by parentid (descending), then by id&lt;br>"; +echo "resulting data is now ordered by parentid (descending), then by id<br>"; dbx_close ($link); -?&gt; +?> +]]> </programlisting> </example> <para> Index: phpdoc/en/functions/dir.xml diff -u phpdoc/en/functions/dir.xml:1.24 phpdoc/en/functions/dir.xml:1.25 --- phpdoc/en/functions/dir.xml:1.24 Sat Nov 10 16:49:33 2001 +++ phpdoc/en/functions/dir.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.24 $ --> +<!-- $Revision: 1.25 $ --> <reference id="ref.dir"> <title>Directory functions</title> <titleabbrev>Directories</titleabbrev> @@ -90,13 +90,15 @@ <example> <title><function>dir</function> example</title> <programlisting role="php"> +<![CDATA[ $d = dir("/etc"); -echo "Handle: ".$d->handle."&lt;br>\n"; -echo "Path: ".$d->path."&lt;br>\n"; +echo "Handle: ".$d->handle."<br>\n"; +echo "Path: ".$d->path."<br>\n"; while ($entry = $d->read()) { - echo $entry."&lt;br>\n"; + echo $entry."<br>\n"; } $d->close(); +]]> </programlisting> </example> </para> @@ -173,7 +175,8 @@ <example> <title><function>opendir</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php if ($dir = @opendir("/tmp")) { while (($file = readdir($dir)) !== false) { @@ -182,7 +185,8 @@ closedir($dir); } -?&gt; +?> +]]> </programlisting> </example> </para> @@ -208,8 +212,9 @@ <example> <title>List all files in the current directory</title> <programlisting role="php"> +<![CDATA[ // Note that !== did not exist until 4.0.0-RC2 -&lt;?php +<?php $handle=opendir('.'); echo "Directory handle: $handle\n"; echo "Files:\n"; @@ -217,7 +222,8 @@ echo "$file\n"; } closedir($handle); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -232,7 +238,8 @@ and <literal>..</literal> </title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $handle = opendir('.'); while (false !== ($file = readdir($handle))) { if ($file != "." &amp;&amp; $file != "..") { @@ -240,7 +247,8 @@ } } closedir($handle); -?&gt; +?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/domxml.xml diff -u phpdoc/en/functions/domxml.xml:1.24 phpdoc/en/functions/domxml.xml:1.25 --- phpdoc/en/functions/domxml.xml:1.24 Sat Nov 10 16:49:34 2001 +++ phpdoc/en/functions/domxml.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.24 $ --> +<!-- $Revision: 1.25 $ --> <reference id="ref.domxml"> <title>DOM XML functions</title> <titleabbrev>DOM XML</titleabbrev> @@ -523,38 +523,40 @@ <example> <title>Retrieving root element</title> <programlisting role="php"> -&lt;?php -$xmlstr = "&lt;?xml version='1.0' standalone='yes'?&gt; -&lt;!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd' -[ &lt;!ENTITY sp \"spanish\"> +<![CDATA[ +<?php +$xmlstr = "<?xml version='1.0' standalone='yes'?> +<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd' +[ <!ENTITY sp \"spanish\"> ]> -&lt;!-- lsfj --&gt; -&lt;chapter language='en'>&lt;title language='en'>Title&lt;/title> - &lt;para language='ge'> +<!-- lsfj --> +<chapter language='en'><title language='en'>Title</title> + <para language='ge'> &amp;sp; - &lt;!-- comment --&gt; - &lt;informaltable language='&amp;sp;'> - &lt;tgroup cols='3'> - &lt;tbody> - &lt;row>&lt;entry>a1&lt;/entry>&lt;entry -morerows='1'>b1&lt;/entry>&lt;entry>c1&lt;/entry>&lt;/row> -&lt;row>&lt;entry>a2&lt;/entry>&lt;entry>c2&lt;/entry>&lt;/row> - &lt;row>&lt;entry>a3&lt;/entry>&lt;entry>b3&lt;/entry>&lt;entry>c3&lt;/entry>&lt;/row> - &lt;/tbody> - &lt;/tgroup> - &lt;/informaltable> - &lt;/para> -&lt;/chapter>"; + <!-- comment --> + <informaltable language='&amp;sp;'> + <tgroup cols='3'> + <tbody> + <row><entry>a1</entry><entry +morerows='1'>b1</entry><entry>c1</entry></row> +<row><entry>a2</entry><entry>c2</entry></row> + <row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row> + </tbody> + </tgroup> + </informaltable> + </para> +</chapter>"; if(!$dom = xmldoc($xmlstr)) { echo "Error while parsing the document\n"; exit; } -$root = $dom-&gt;root(); +$root = $dom->root(); /* or $root = domxml_root($dom); */ print_r($root); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -586,13 +588,15 @@ <example> <title>Creating a simple HTML document header</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $doc = new_xmldoc("1.0"); -$root = $doc-&gt;add_root("HTML"); -$head = $root-&gt;new_child("HEAD", ""); -$head-&gt;new_child("TITLE", "Hier der Titel"); -echo $doc-&gt;dumpmem(); -?&gt; +$root = $doc->add_root("HTML"); +$head = $root->new_child("HEAD", ""); +$head->new_child("TITLE", "Hier der Titel"); +echo $doc->dumpmem(); +?> +]]> </programlisting> </example> </para> @@ -704,14 +708,16 @@ <example> <title>Adding an attribute to an element</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $doc = new_xmldoc("1.0"); -$root = $doc-&gt;add_root("HTML"); -$head = $root-&gt;new_child("HEAD", ""); -$head-&gt;new_child("TITLE", "Hier der Titel"); -$head-&gt;set_attribute("Language", "ge"); -echo $doc-&gt;dumpmem(); -?&gt; +$root = $doc->add_root("HTML"); +$head = $root->new_child("HEAD", ""); +$head->new_child("TITLE", "Hier der Titel"); +$head->set_attribute("Language", "ge"); +echo $doc->dumpmem(); +?> +]]> </programlisting> </example> </para> @@ -744,14 +750,16 @@ <example> <title>Adding an attribute to an element</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $doc = new_xmldoc("1.0"); -$root = $doc-&gt;add_root("HTML"); -$head = $root-&gt;new_child("HEAD", ""); -$head-&gt;new_child("TITLE", "Hier der Titel"); -$head-&gt;set_attribute("Language", "ge"); -$children = $head-&gt;children(); -?&gt; +$root = $doc->add_root("HTML"); +$head = $root->new_child("HEAD", ""); +$head->new_child("TITLE", "Hier der Titel"); +$head->set_attribute("Language", "ge"); +$children = $head->children(); +?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/errorfunc.xml diff -u phpdoc/en/functions/errorfunc.xml:1.19 phpdoc/en/functions/errorfunc.xml:1.20 --- phpdoc/en/functions/errorfunc.xml:1.19 Sat Nov 10 16:49:34 2001 +++ phpdoc/en/functions/errorfunc.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.19 $ --> +<!-- $Revision: 1.20 $ --> <reference id="ref.errorfunc"> <title>Error Handling and Logging Functions</title> <titleabbrev>Errors and Logging</titleabbrev> @@ -109,6 +109,7 @@ <example role="php"> <title><function>error_log</function> examples</title> <programlisting role="php"> +<![CDATA[ // Send notification through the server log if we can not // connect to the database. if (!Ora_Logon ($username, $password)) { @@ -125,6 +126,7 @@ error_log ("You messed up!", 2, "127.0.0.1:7000"); error_log ("You messed up!", 2, "loghost"); error_log ("You messed up!", 3, "/var/tmp/my-errors.log"); +]]> </programlisting> </example> </para> @@ -156,6 +158,7 @@ <example role="php"> <title>Error Integer changes</title> <programlisting role="php"> +<![CDATA[ error_reporting (55); // PHP 3 equivalent to E_ALL ^ E_NOTICE /* ...in PHP 4, '55' would mean (E_ERROR | E_WARNING | E_PARSE | @@ -164,6 +167,7 @@ error_reporting (2039); // PHP 4 equivalent to E_ALL ^ E_NOTICE error_reporting (E_ALL ^ E_NOTICE); // The same in both PHP 3 and 4 +]]> </programlisting> </example> Follow the links for the internal values to get their meanings: @@ -251,6 +255,7 @@ <example role="php"> <title><function>error_reporting</function> examples</title> <programlisting role="php"> +<![CDATA[ error_reporting(0); /* Turn off all reporting */ @@ -265,6 +270,7 @@ error_reporting (63); // Old syntax, PHP 2/3 error_reporting (E_ALL); // New syntax for PHP 3/4 /* report all PHP errors */ +]]> </programlisting> </example> </para> @@ -341,7 +347,8 @@ <function>trigger_error</function> </title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // redefine the user error constants - PHP 4 only define (FATAL,E_USER_ERROR); @@ -355,36 +362,36 @@ function myErrorHandler ($errno, $errstr, $errfile, $errline) { switch ($errno) { case FATAL: - echo &quot;&lt;b&gt;FATAL&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;; - echo &quot; Fatal error in line &quot;.$errline.&quot; of file &quot;.$errfile; - echo &quot;, PHP &quot;.PHP_VERSION.&quot; (&quot;.PHP_OS.&quot;)&lt;br&gt;\n&quot;; - echo &quot;Aborting...&lt;br&gt;\n&quot;; + echo "<b>FATAL</b> [$errno] $errstr<br>\n"; + echo " Fatal error in line ".$errline." of file ".$errfile; + echo ", PHP ".PHP_VERSION." (".PHP_OS.")<br>\n"; + echo "Aborting...<br>\n"; exit -1; break; case ERROR: - echo &quot;&lt;b&gt;ERROR&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;; + echo "<b>ERROR</b> [$errno] $errstr<br>\n"; break; case WARNING: - echo &quot;&lt;b&gt;WARNING&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;; + echo "<b>WARNING</b> [$errno] $errstr<br>\n"; break; default: - echo &quot;Unkown error type: [$errno] $errstr&lt;br&gt;\n&quot;; + echo "Unkown error type: [$errno] $errstr<br>\n"; break; } } // function to test the error handling function scale_by_log ($vect, $scale) { - if ( !is_numeric($scale) || $scale &lt;= 0 ) - trigger_error(&quot;log(x) for x &lt;= 0 is undefined, you used: scale = $scale&quot;, + if ( !is_numeric($scale) || $scale <= 0 ) + trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", FATAL); if (!is_array($vect)) { - trigger_error(&quot;Incorrect input vector, array of values expected&quot;, ERROR); + trigger_error("Incorrect input vector, array of values expected", ERROR); return null; } - for ($i=0; $i&lt;count($vect); $i++) { + for ($i=0; $i<count($vect); $i++) { if (!is_numeric($vect[$i])) - trigger_error(&quot;Value at position $i is not a number, using 0 (zero)&quot;, + trigger_error("Value at position $i is not a number, using 0 (zero)", WARNING); $temp[$i] = log($scale) * $vect[$i]; } @@ -392,64 +399,67 @@ } // set to the user defined error handler -$old_error_handler = set_error_handler(&quot;myErrorHandler&quot;); +$old_error_handler = set_error_handler("myErrorHandler"); // trigger some errors, first define a mixed array with a non-numeric item -echo &quot;vector a\n&quot;; -$a = array(2,3,&quot;foo&quot;,5.5,43.3,21.11); +echo "vector a\n"; +$a = array(2,3,"foo",5.5,43.3,21.11); print_r($a); // now generate second array, generating a warning -echo &quot;----\nvector b - a warning (b = log(PI) * a)\n&quot;; +echo "----\nvector b - a warning (b = log(PI) * a)\n"; $b = scale_by_log($a, M_PI); print_r($b); // this is trouble, we pass a string instead of an array -echo &quot;----\nvector c - an error\n&quot;; -$c = scale_by_log(&quot;not array&quot;,2.3); +echo "----\nvector c - an error\n"; +$c = scale_by_log("not array",2.3); var_dump($c); // this is a critical error, log of zero or negative number is undefined -echo &quot;----\nvector d - fatal error\n&quot;; +echo "----\nvector d - fatal error\n"; $d = scale_by_log($a, -2.5); -?&gt; +?> +]]> </programlisting> </example> And when you run this sample script, the output will be <informalexample> <programlisting> +<![CDATA[ vector a Array ( - [0] =&gt; 2 - [1] =&gt; 3 - [2] =&gt; foo - [3] =&gt; 5.5 - [4] =&gt; 43.3 - [5] =&gt; 21.11 + [0] => 2 + [1] => 3 + [2] => foo + [3] => 5.5 + [4] => 43.3 + [5] => 21.11 ) ---- vector b - a warning (b = log(PI) * a) -&lt;b&gt;WARNING&lt;/b&gt; [1024] Value at position 2 is not a number, using 0 (zero)&lt;br&gt; +<b>WARNING</b> [1024] Value at position 2 is not a number, using 0 (zero)<br> Array ( - [0] =&gt; 2.2894597716988 - [1] =&gt; 3.4341896575482 - [2] =&gt; 0 - [3] =&gt; 6.2960143721717 - [4] =&gt; 49.566804057279 - [5] =&gt; 24.165247890281 + [0] => 2.2894597716988 + [1] => 3.4341896575482 + [2] => 0 + [3] => 6.2960143721717 + [4] => 49.566804057279 + [5] => 24.165247890281 ) ---- vector c - an error -&lt;b&gt;ERROR&lt;/b&gt; [512] Incorrect input vector, array of values expected&lt;br&gt; +<b>ERROR</b> [512] Incorrect input vector, array of values expected<br> NULL ---- vector d - fatal error -&lt;b&gt;FATAL&lt;/b&gt; [256] log(x) for x &lt;= 0 is undefined, you used: scale = -2.5&lt;br&gt; - Fatal error in line 36 of file trigger_error.php, PHP 4.0.2 (Linux)&lt;br&gt; -Aborting...&lt;br&gt; +<b>FATAL</b> [256] log(x) for x <= 0 is undefined, you used: scale = -2.5<br> + Fatal error in line 36 of file trigger_error.php, PHP 4.0.2 (Linux)<br> +Aborting...<br> +]]> </programlisting> </informalexample> </para> @@ -507,8 +517,10 @@ For example: <informalexample> <programlisting> +<![CDATA[ if (assert ($divisor == 0)) trigger_error ("Cannot divide by zero", E_USER_ERROR); +]]> </programlisting> </informalexample> <note> Index: phpdoc/en/functions/exec.xml diff -u phpdoc/en/functions/exec.xml:1.21 phpdoc/en/functions/exec.xml:1.22 --- phpdoc/en/functions/exec.xml:1.21 Sat Nov 10 16:49:34 2001 +++ phpdoc/en/functions/exec.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.21 $ --> +<!-- $Revision: 1.22 $ --> <reference id="ref.exec"> <title>Program Execution functions</title> <titleabbrev>Program Execution</titleabbrev> @@ -38,7 +38,9 @@ <para> <informalexample> <programlisting role="php"> +<![CDATA[ system("ls ".escapeshellarg($dir)); +]]> </programlisting> </informalexample> </para> @@ -76,10 +78,12 @@ <para> <informalexample> <programlisting role="php"> +<![CDATA[ $e = escapeshellcmd($userinput); system("echo $e"); // here we don't care if $e has spaces $f = escapeshellcmd($filename); system("touch \"/tmp/$f\"; ls -l \"/tmp/$f\""); // and here we do, so we use quotes +]]> </programlisting> </informalexample> </para> Index: phpdoc/en/functions/fbsql.xml diff -u phpdoc/en/functions/fbsql.xml:1.31 phpdoc/en/functions/fbsql.xml:1.32 --- phpdoc/en/functions/fbsql.xml:1.31 Sat Nov 10 16:49:34 2001 +++ phpdoc/en/functions/fbsql.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.31 $ --> +<!-- $Revision: 1.32 $ --> <reference id="ref.fbsql"> <title>FrontBase Functions</title> <titleabbrev>FrontBase</titleabbrev> @@ -194,12 +194,14 @@ <example> <title><function>fbsql_close</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_connect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); print ("Connected successfully"); fbsql_close ($link); -?&gt; +?> +]]> </programlisting> </example> <para> @@ -295,14 +297,16 @@ <example> <title><function>fbsql_connect</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_connect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); print ("Connected successfully"); fbsql_close ($link); -?&gt; +?> +]]> </programlisting> </example> <para> @@ -339,7 +343,8 @@ <example> <title><function>fbsql_create_db</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); if (fbsql_create_db ("my_db")) { @@ -347,7 +352,8 @@ } else { printf("Error creating database: %s\n", fbsql_error ()); } -?&gt; +?> +]]> </programlisting> </example> <para> @@ -385,7 +391,8 @@ <example> <title><function>fbsql_create_blob</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); $filename = "blobfile.bin"; @@ -397,7 +404,8 @@ $sql = "INSERT INTO BLOB_TABLE (BLOB_COLUMN) VALUES ($blobHandle);"; $rs = fbsql_query($sql, $link); -?&gt; +?> +]]> </programlisting> </example> <para> @@ -438,7 +446,8 @@ <example> <title><function>fbsql_create_clob</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); $filename = "clob_file.txt"; @@ -450,7 +459,8 @@ $sql = "INSERT INTO CLOB_TABLE (CLOB_COLUMN) VALUES ($clobHandle);"; $rs = fbsql_query($sql, $link); -?&gt; +?> +]]> </programlisting> </example> <para> @@ -538,7 +548,8 @@ <example> <title><function>fbsql_data_seek</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); @@ -560,11 +571,12 @@ if(!($row = fbsql_fetch_object ($result))) continue; - printf("%s %s&lt;BR>\n", $row->last_name, $row->first_name); + printf("%s %s<BR>\n", $row->last_name, $row->first_name); } fbsql_free_result ($result); -?&gt; +?> +]]> </programlisting> </example> </refsect1> @@ -751,14 +763,16 @@ sure you check the value before calling another fbsql function. <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php fbsql_connect("marliesle"); -echo fbsql_errno().": ".fbsql_error()."&lt;BR>"; +echo fbsql_errno().": ".fbsql_error()."<BR>"; fbsql_select_db("nonexistentdb"); -echo fbsql_errno().": ".fbsql_error()."&lt;BR>"; +echo fbsql_errno().": ".fbsql_error()."<BR>"; $conn = fbsql_query("SELECT * FROM nonexistenttable;"); -echo fbsql_errno().": ".fbsql_error()."&lt;BR>"; -?&gt; +echo fbsql_errno().": ".fbsql_error()."<BR>"; +?> +]]> </programlisting> </informalexample> </para> @@ -803,14 +817,16 @@ sure you check the value before calling another fbsql function. <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php fbsql_connect("marliesle"); -echo fbsql_errno().": ".fbsql_error()."&lt;BR>"; +echo fbsql_errno().": ".fbsql_error()."<BR>"; fbsql_select_db("nonexistentdb"); -echo fbsql_errno().": ".fbsql_error()."&lt;BR>"; +echo fbsql_errno().": ".fbsql_error()."<BR>"; $conn = fbsql_query("SELECT * FROM nonexistenttable;"); -echo fbsql_errno().": ".fbsql_error()."&lt;BR>"; -?&gt; +echo fbsql_errno().": ".fbsql_error()."<BR>"; +?> +]]> </programlisting> </informalexample> </para> @@ -859,7 +875,9 @@ make an alias for the column. <informalexample> <programlisting> +<![CDATA[ select t1.f1 as foo t2.f1 as bar from t1, t2 +]]> </programlisting> </informalexample> </para> @@ -883,17 +901,19 @@ <example> <title><function>fbsql_fetch_array</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php fbsql_connect ($host, $user, $password); $result = fbsql_db_query ("database","select user_id, fullname from table"); while ($row = fbsql_fetch_array ($result)) { - echo "user_id: ".$row["user_id"]."&lt;br>\n"; - echo "user_id: ".$row[0]."&lt;br>\n"; - echo "fullname: ".$row["fullname"]."&lt;br>\n"; - echo "fullname: ".$row[1]."&lt;br>\n"; + echo "user_id: ".$row["user_id"]."<br>\n"; + echo "user_id: ".$row[0]."<br>\n"; + echo "fullname: ".$row["fullname"]."<br>\n"; + echo "fullname: ".$row[1]."<br>\n"; } fbsql_free_result ($result); -?&gt; +?> +]]> </programlisting> </example> </refsect1> @@ -945,7 +965,8 @@ <example> <title><function>fbsql_fetch_assoc</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php fbsql_connect ($host, $user, $password); $result = fbsql_db_query ("database","select * from table"); while ($row = fbsql_fetch_assoc ($result)) { @@ -953,7 +974,8 @@ echo $row["fullname"]; } fbsql_free_result ($result); -?&gt; +?> +]]> </programlisting> </example> </refsect1> @@ -1021,30 +1043,32 @@ <example> <title><function>fbsql_fetch_field</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php fbsql_connect ($host, $user, $password) or die ("Could not connect"); $result = fbsql_db_query ("database", "select * from table") or die ("Query failed"); # get column metadata $i = 0; -while ($i &lt; fbsql_num_fields ($result)) { - echo "Information for column $i:&lt;BR>\n"; +while ($i < fbsql_num_fields ($result)) { + echo "Information for column $i:<BR>\n"; $meta = fbsql_fetch_field ($result); if (!$meta) { - echo "No information available&lt;BR>\n"; + echo "No information available<BR>\n"; } - echo "&lt;PRE> + echo "<PRE> max_length: $meta->max_length name: $meta->name not_null: $meta->not_null table: $meta->table type: $meta->type -&lt;/PRE>"; +</PRE>"; $i++; } fbsql_free_result ($result); -?&gt; +?> +]]> </programlisting> </example> <para> @@ -1131,7 +1155,8 @@ <example> <title><function>fbsql_fetch_object</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php fbsql_connect ($host, $user, $password); $result = fbsql_db_query ("database", "select * from table"); while ($row = fbsql_fetch_object ($result)) { @@ -1139,7 +1164,8 @@ echo $row->fullname; } fbsql_free_result ($result); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -1248,6 +1274,7 @@ <example> <title><function>fbsql_field_name</function> example</title> <programlisting role="php"> +<![CDATA[ // The users table consists of three fields: // user_id // username @@ -1257,6 +1284,7 @@ echo fbsql_field_name($res, 0) . "\n"; echo fbsql_field_name($res, 2); +]]> </programlisting> </example> </para> @@ -1264,8 +1292,10 @@ The above example would produce the following output: <informalexample> <programlisting> +<![CDATA[ user_id password +]]> </programlisting> </informalexample> </para> @@ -1372,7 +1402,8 @@ <example> <title><function>fbsql_field_type</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php fbsql_connect ("localhost", "_SYSTEM", ""); fbsql_select_db ("wisconsin"); @@ -1381,19 +1412,20 @@ $rows = fbsql_num_rows ($result); $i = 0; $table = fbsql_field_table ($result, $i); -echo "Your '".$table."' table has ".$fields." fields and ".$rows." records &lt;BR>"; -echo "The table has the following fields &lt;BR>"; -while ($i &lt; $fields) { +echo "Your '".$table."' table has ".$fields." fields and ".$rows." records <BR>"; +echo "The table has the following fields <BR>"; +while ($i < $fields) { $type = fbsql_field_type ($result, $i); $name = fbsql_field_name ($result, $i); $len = fbsql_field_len ($result, $i); $flags = fbsql_field_flags ($result, $i); - echo $type." ".$name." ".$len." ".$flags."&lt;BR>"; + echo $type." ".$name." ".$len." ".$flags."<BR>"; $i++; } fbsql_close(); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -1498,12 +1530,14 @@ <example> <title><function>fbsql_list_dbs</function> example</title> <programlisting role="php"> +<![CDATA[ $link = fbsql_connect('localhost', 'myname', 'secret'); $db_list = fbsql_list_dbs($link); while ($row = fbsql_fetch_object($db_list)) { echo $row->Database . "\n"; } +]]> </programlisting> </example> </para> @@ -1511,10 +1545,12 @@ The above example would produce the following output: <informalexample> <programlisting> +<![CDATA[ database1 database2 database3 ... +]]> </programlisting> </informalexample> </para> @@ -1566,14 +1602,16 @@ <example> <title><function>fbsql_list_fields</function> example</title> <programlisting role="php"> +<![CDATA[ $link = fbsql_connect('localhost', 'myname', 'secret'); $fields = fbsql_list_fields("database1", "table1", $link); $columns = fbsql_num_fields($fields); -for ($i = 0; $i &lt; $columns; $i++) { +for ($i = 0; $i < $columns; $i++) { echo fbsql_field_name($fields, $i) . "\n";; } +]]> </programlisting> </example> </para> @@ -1581,10 +1619,12 @@ The above example would produce the following output: <informalexample> <programlisting> +<![CDATA[ field1 field2 field3 ... +]]> </programlisting> </informalexample> </para> @@ -1649,7 +1689,8 @@ <example> <title><function>fbsql_next_result</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_connect ("localhost", "_SYSTEM", "secret"); fbsql_select_db("MyDB", $link); $SQL = "Select * from table1; select * from table2;"; @@ -1660,7 +1701,8 @@ } while (fbsql_next_result($rs)); fbsql_free_result($rs); fbsql_close ($link); -?&gt; +?> +]]> </programlisting> </example> </refsect1> @@ -1714,7 +1756,8 @@ <example> <title><function>fbsql_num_rows</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_connect("localhost", "username", "password"); fbsql_select_db("database", $link); @@ -1724,7 +1767,8 @@ echo "$num_rows Rows\n"; -?&gt; +?> +]]> </programlisting> </example> </para> @@ -1840,10 +1884,12 @@ <example> <title><function>fbsql_query</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $result = fbsql_query ("SELECT * WHERE 1=1") or die ("Invalid query"); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -1855,10 +1901,12 @@ <example> <title><function>fbsql_query</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $result = fbsql_query ("SELECT my_col FROM my_tbl") or die ("Invalid query"); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -1929,7 +1977,8 @@ <example> <title><function>fbsql_read_blob</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); $sql = "SELECT BLOB_COLUMN FROM BLOB_TABLE;"; @@ -1945,7 +1994,8 @@ $blob_data = fbsql_read_blob($row_data[0]); fbsql_free_result($rs); -?&gt; +?> +]]> </programlisting> </example> <para> @@ -1991,7 +2041,8 @@ <example> <title><function>fbsql_read_clob</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); $sql = "SELECT CLOB_COLUMN FROM CLOB_TABLE;"; @@ -2007,7 +2058,8 @@ $clob_data = fbsql_read_clob($row_data[0]); fbsql_free_result($rs); -?&gt; +?> +]]> </programlisting> </example> <para> @@ -2293,16 +2345,18 @@ <example> <title><function>fbsql_tablename</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php fbsql_connect ("localhost", "_SYSTEM", ""); $result = fbsql_list_tables ("wisconsin"); $i = 0; -while ($i &lt; fbsql_num_rows ($result)) { +while ($i < fbsql_num_rows ($result)) { $tb_names[$i] = fbsql_tablename ($result, $i); - echo $tb_names[$i] . "&lt;BR>"; + echo $tb_names[$i] . "<BR>"; $i++; } -?&gt; +?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/fdf.xml diff -u phpdoc/en/functions/fdf.xml:1.21 phpdoc/en/functions/fdf.xml:1.22 --- phpdoc/en/functions/fdf.xml:1.21 Sat Nov 10 16:49:34 2001 +++ phpdoc/en/functions/fdf.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.21 $ --> +<!-- $Revision: 1.22 $ --> <reference id="ref.fdf"> <title>Forms Data Format functions</title> <titleabbrev>FDF</titleabbrev> @@ -58,7 +58,8 @@ <example> <title>Evaluating a FDF document</title> <programlisting> -&lt;?php +<![CDATA[ +<?php // Save the FDF data into a temp file $fdffp = fopen("test.fdf", "w"); fwrite($fdffp, $HTTP_FDF_DATA, strlen($HTTP_FDF_DATA)); @@ -70,27 +71,28 @@ // show_publisher and show_preparer. $fdf = fdf_open("test.fdf"); $volume = fdf_get_value($fdf, "volume"); -echo "The volume field has the value '&lt;B>$volume&lt;/B>'&lt;BR>"; +echo "The volume field has the value '<B>$volume</B>'<BR>"; $date = fdf_get_value($fdf, "date"); -echo "The date field has the value '&lt;B>$date&lt;/B>'&lt;BR>"; +echo "The date field has the value '<B>$date</B>'<BR>"; $comment = fdf_get_value($fdf, "comment"); -echo "The comment field has the value '&lt;B>$comment&lt;/B>'&lt;BR>"; +echo "The comment field has the value '<B>$comment</B>'<BR>"; if(fdf_get_value($fdf, "show_publisher") == "On") { $publisher = fdf_get_value($fdf, "publisher"); - echo "The publisher field has the value '&lt;B>$publisher&lt;/B>'&lt;BR>"; + echo "The publisher field has the value '<B>$publisher</B>'<BR>"; } else - echo "Publisher shall not be shown.&lt;BR>"; + echo "Publisher shall not be shown.<BR>"; if(fdf_get_value($fdf, "show_preparer") == "On") { $preparer = fdf_get_value($fdf, "preparer"); - echo "The preparer field has the value '&lt;B>$preparer&lt;/B>'&lt;BR>"; + echo "The preparer field has the value '<B>$preparer</B>'<BR>"; } else - echo "Preparer shall not be shown.&lt;BR>"; + echo "Preparer shall not be shown.<BR>"; fdf_close($fdf); -?&gt; +?> +]]> </programlisting> </example> @@ -122,7 +124,8 @@ <example> <title>Accessing the form data</title> <programlisting> -&lt;?php +<![CDATA[ +<?php // Save the FDF data into a temp file $fdffp = fopen("test.fdf", "w"); fwrite($fdffp, $HTTP_FDF_DATA, strlen($HTTP_FDF_DATA)); @@ -132,7 +135,8 @@ $fdf = fdf_open("test.fdf"); ... fdf_close($fdf); -?&gt; +?> +]]> </programlisting> </example></para> @@ -185,7 +189,8 @@ <example> <title>Populating a PDF document</title> <programlisting> -&lt;?php +<![CDATA[ +<?php $outfdf = fdf_create(); fdf_set_value($outfdf, "volume", $volume, 0); @@ -196,7 +201,8 @@ $fp = fopen("outtest.fdf", "r"); fpassthru($fp); unlink("outtest.fdf"); -?&gt; +?> +]]> </programlisting> </example></para> Index: phpdoc/en/functions/filesystem.xml diff -u phpdoc/en/functions/filesystem.xml:1.87 phpdoc/en/functions/filesystem.xml:1.88 --- phpdoc/en/functions/filesystem.xml:1.87 Sun Nov 11 06:53:09 2001 +++ phpdoc/en/functions/filesystem.xml Sat Nov 17 22:07:17 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.87 $ --> +<!-- $Revision: 1.88 $ --> <reference id="ref.filesystem"> <title>Filesystem functions</title> <titleabbrev>Filesystem</titleabbrev> @@ -36,9 +36,11 @@ <example> <title><function>basename</function> example</title> <programlisting role="php"> +<![CDATA[ $path = "/home/httpd/html/index.php"; $file = basename ($path); // $file is set to "index.php" $file = basename ($path,".php"); // $file is set to "index" +]]> </programlisting> </example> </para> @@ -115,9 +117,11 @@ you need to prefix <parameter>mode</parameter> with a zero (0): <informalexample> <programlisting role="php"> +<![CDATA[ chmod ("/somedir/somefile", 755); // decimal; probably incorrect chmod ("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect chmod ("/somedir/somefile", 0755); // octal; correct value of mode +]]> </programlisting> </informalexample> </para> @@ -238,9 +242,11 @@ <example> <title><function>copy</function> example</title> <programlisting role="php"> +<![CDATA[ if (!copy($file, $file.'.bak')) { - print ("failed to copy $file...&lt;br>\n"); + print ("failed to copy $file...<br>\n"); } +]]> </programlisting> </example> </para> @@ -300,8 +306,10 @@ <example> <title><function>dirname</function> example</title> <programlisting role="php"> +<![CDATA[ $path = "/etc/passwd"; $file = dirname ($path); // $file is set to "/etc" +]]> </programlisting> </example> </para> @@ -333,8 +341,10 @@ <example> <title><function>disk_free_space</function> example</title> <programlisting role="php"> +<![CDATA[ $df = disk_free_space("/"); // $df contains the number of bytes // available on "/" +]]> </programlisting> </example> </para> @@ -384,8 +394,10 @@ <example> <title><function>disk_total_space</function> example</title> <programlisting role="php"> +<![CDATA[ $df = disk_total_space("/"); // $df contains the total number of // bytes available on "/" +]]> </programlisting> </example> </para> @@ -554,17 +566,19 @@ contents of a CSV file </title> <programlisting role="php"> +<![CDATA[ $row = 1; $fp = fopen ("test.csv","r"); while ($data = fgetcsv ($fp, 1000, ",")) { $num = count ($data); - print "&lt;p&gt; $num fields in line $row: &lt;br&gt;"; + print "<p> $num fields in line $row: <br>"; $row++; - for ($c=0; $c&lt;$num; $c++) { - print $data[$c] . "&lt;br&gt;"; + for ($c=0; $c < $num; $c++) { + print $data[$c] . "<br>"; } } fclose ($fp); +]]> </programlisting> </example> </refsect1> @@ -611,12 +625,14 @@ <example> <title>Reading a file line by line</title> <programlisting role="php"> +<![CDATA[ $fd = fopen ("/tmp/inputfile.txt", "r"); while (!feof ($fd)) { $buffer = fgets($fd, 4096); echo $buffer; } fclose ($fd); +]]> </programlisting> </example> </para> @@ -703,16 +719,18 @@ <para> <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // get a web page into an array and print it out $fcontents = file ('http://www.php.net'); while (list ($line_num, $line) = each ($fcontents)) { - echo "&lt;b&gt;Line $line_num:&lt;/b&gt; " . htmlspecialchars ($line) . "&lt;br&gt;\n"; + echo "<b>Line $line_num:</b>; " . htmlspecialchars ($line) . "<br>\n"; } // get a web page into a string $fcontents = join ('', file ('http://www.php.net')); -?&gt; +?> +]]> </programlisting> </informalexample> </para> @@ -1266,10 +1284,12 @@ <example> <title><function>fopen</function> example</title> <programlisting role="php"> +<![CDATA[ $fp = fopen ("/home/rasmus/file.txt", "r"); $fp = fopen ("/home/rasmus/file.gif", "wb"); $fp = fopen ("http://www.php.net/", "r"); $fp = fopen ("ftp://user:password@example.com/", "w"); +]]> </programlisting> </example> </para> @@ -1284,7 +1304,9 @@ used in the path to the file, or use forward slashes. <informalexample> <programlisting role="php"> +<![CDATA[ $fp = fopen ("c:\\data\\info.txt", "r"); +]]> </programlisting> </informalexample> </para> @@ -1392,11 +1414,13 @@ <para> <informalexample> <programlisting role="php"> +<![CDATA[ // get contents of a file into a string $filename = "/usr/local/something.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); +]]> </programlisting> </informalexample> </para> @@ -1410,10 +1434,12 @@ <para> <informalexample> <programlisting role="php"> +<![CDATA[ $filename = "c:\\files\\somepic.gif"; $fd = fopen ($filename, "rb"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); +]]> </programlisting> </informalexample> </para> @@ -1457,21 +1483,25 @@ <example> <title><function>fscanf</function> Example</title> <programlisting role="php"> +<![CDATA[ $fp = fopen ("users.txt","r"); while ($userinfo = fscanf ($fp, "%s\t%s\t%s\n")) { list ($name, $profession, $countrycode) = $userinfo; //... do something with the values } fclose($fp); +]]> </programlisting> </example> <example> <title>users.txt</title> <programlisting> +<![CDATA[ javier argonaut pe hiroshi sculptor jp robert slacker us luigi florist it +]]> </programlisting> </example> </para> @@ -1730,12 +1760,14 @@ <example> <title><function>set_file_buffer</function> example</title> <programlisting role="php"> +<![CDATA[ $fp=fopen($file, "w"); if($fp){ set_file_buffer($fp, 0); fputs($fp, $output); fclose($fp); } +]]> </programlisting> </example> </para> @@ -2101,7 +2133,9 @@ can change using <function>umask</function>. <informalexample> <programlisting role="php"> +<![CDATA[ mkdir ("/path/to/my/dir", 0700); +]]> </programlisting> </informalexample> </para> @@ -2216,6 +2250,7 @@ <example> <title>Contents of sample.ini</title> <programlisting> +<![CDATA[ ; This is a sample configuration file ; Comments start with ';', as in php.ini @@ -2225,6 +2260,7 @@ [second_section] path = /usr/local/bin +]]> </programlisting> </example> </para> @@ -2252,6 +2288,7 @@ Would produce: <informalexample> <programlisting> +<![CDATA[ Array ( [one] => 1 @@ -2272,6 +2309,7 @@ ) ) +]]> </programlisting> </informalexample> </para> @@ -2302,7 +2340,8 @@ <example> <title><function>pathinfo</function> Example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $path_parts = pathinfo("/www/htdocs/index.html"); @@ -2310,7 +2349,8 @@ echo $path_parts["basename"] . "\n"; echo $path_parts["extension"] . "\n"; -?&gt; +?> +]]> </programlisting> </example> </para> @@ -2318,9 +2358,11 @@ Would produce: <informalexample> <programlisting> +<![CDATA[ /www/htdocs index.html html +]]> </programlisting> </informalexample> </para> @@ -2395,7 +2437,9 @@ <para> <informalexample> <programlisting role="php"> +<![CDATA[ $fp = popen ("/bin/ls", "r"); +]]> </programlisting> </informalexample> </para> @@ -2699,7 +2743,9 @@ <example> <title><function>realpath</function> example</title> <programlisting role="php"> +<![CDATA[ $real_path = realpath ("../../index.php"); +]]> </programlisting> </example> </para> @@ -2773,7 +2819,9 @@ <example> <title><function>tempnam</function> example</title> <programlisting role="php"> +<![CDATA[ $tmpfname = tempnam ("/tmp", "FOO"); +]]> </programlisting> </example> </para> @@ -2854,12 +2902,14 @@ <example> <title><function>touch</function> example</title> <programlisting role="php"> +<![CDATA[ if (touch ($FileName)) { print "$FileName modification time has been changed to todays date and time"; } else { print "Sorry Could Not change modification time of $FileName"; } +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/ftp.xml diff -u phpdoc/en/functions/ftp.xml:1.26 phpdoc/en/functions/ftp.xml:1.27 --- phpdoc/en/functions/ftp.xml:1.26 Mon Nov 12 10:33:28 2001 +++ phpdoc/en/functions/ftp.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.26 $ --> +<!-- $Revision: 1.27 $ --> <reference id="ref.ftp"> <title>FTP functions</title> <titleabbrev>FTP</titleabbrev> @@ -26,7 +26,8 @@ <example> <title><function>ftp</function> example</title> <programlisting> -&lt;?php +<![CDATA[ +<?php // set up basic connection $conn_id = ftp_connect("$ftp_server"); @@ -55,6 +56,7 @@ // close the FTP stream ftp_quit($conn_id); ?> +]]> </programlisting> </example> </para> @@ -401,7 +403,9 @@ <example> <title><function>ftp_put</function> example</title> <programlisting role="php"> +<![CDATA[ $upload = ftp_put ($conn_id, "$destination_file", "$source_file", FTP_ASCII); +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/funchand.xml diff -u phpdoc/en/functions/funchand.xml:1.19 phpdoc/en/functions/funchand.xml:1.20 --- phpdoc/en/functions/funchand.xml:1.19 Sat Nov 10 16:49:35 2001 +++ phpdoc/en/functions/funchand.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.19 $ --> +<!-- $Revision: 1.20 $ --> <reference id="ref.funchand"> <title>Function Handling functions</title> <titleabbrev>Functions</titleabbrev> @@ -40,6 +40,7 @@ For example: <informalexample> <programlisting role="php"> +<![CDATA[ function debug($var, $val) echo "***DEBUGGING\nVARIABLE: $var\nVALUE:"; if (is_array($val) || is_object($val) || is_resource($val)) @@ -55,6 +56,7 @@ call_user_func_array ('debug', array("host", $host)); call_user_func_array ('debug', array("c", $c)); call_user_func_array ('debug', array("HTTP_POST_VARS", $HTTP_POST_VARS)); +]]> </programlisting> </informalexample> </para> @@ -103,11 +105,13 @@ following: <informalexample> <programlisting role="php"> +<![CDATA[ function barber ($type) { print "You wanted a $type haircut, no problem"; } call_user_func ('barber', "mushroom"); call_user_func ('barber', "shave"); +]]> </programlisting> </informalexample> </para> @@ -153,12 +157,14 @@ Creating an anonymous function with <function>create_function</function> </title> <programlisting role="php"> +<![CDATA[ $newfunc = create_function('$a,$b','return "ln($a) + ln($b) = ".log($a * $b);'); echo "New anonymous function: $newfunc\n"; echo $newfunc(2,M_E)."\n"; // outputs // New anonymous function: lambda_1 // ln(2) + ln(2.718281828459) = 1.6931471805599 +]]> </programlisting> </example> Or, perhaps to have general handler function that can apply a set @@ -169,15 +175,16 @@ <function>create_function</function> </title> <programlisting role="php"> +<![CDATA[ function process($var1, $var2, $farr) { - for ($f=0; $f &lt; count($farr); $f++) + for ($f=0; $f < count($farr); $f++) echo $farr[$f]($var1,$var2)."\n"; } // create a bunch of math functions -$f1 = 'if ($a &gt;=0) {return "b*a^2 = ".$b*sqrt($a);} else {return false;}'; +$f1 = 'if ($a >=0) {return "b*a^2 = ".$b*sqrt($a);} else {return false;}'; $f2 = "return \"min(b^2+a, a^2,b) = \".min(\$a*\$a+\$b,\$b*\$b+\$a);"; -$f3 = 'if ($a &gt; 0 &amp;&amp; $b != 0) {return "ln(a)/b = ".log($a)/$b;} else {return false;}'; +$f3 = 'if ($a > 0 &amp;&amp; $b != 0) {return "ln(a)/b = ".log($a)/$b;} else {return false;}'; $farr = array( create_function('$x,$y', 'return "some trig: ".(sin($x) + $x*cos($y));'), create_function('$x,$y', 'return "a hypotenuse: ".sqrt($x*$x + $y*$y);'), @@ -199,11 +206,13 @@ ); echo "\nUsing the second array of anonymous functions\n"; process("Twas brilling and the slithy toves", "Twas the night", $garr); +]]> </programlisting> </example> and when you run the code above, the output will be: <informalexample> <programlisting> +<![CDATA[ Using the first array of anonymous functions parameters: 2.3445, M_PI some trig: -1.6291725057799 @@ -217,6 +226,7 @@ ** Look the same to me! (looking at the first 3 chars) CRCs: -725381282 , 1908338681 similar(a,b) = 11(45.833333333333%) +]]> </programlisting> </informalexample> But perhaps the most common use for of lambda-style (anonymous) functions @@ -225,16 +235,17 @@ <example> <title>Using anonymous functions as callback functions</title> <programlisting role="php"> +<![CDATA[ $av = array("the ","a ","that ","this "); array_walk($av, create_function('&amp;$v,$k','$v = $v."mango";')); print_r($av); // for PHP 3 use var_dump() // outputs: // Array // ( -// [0] =&gt; the mango -// [1] =&gt; a mango -// [2] =&gt; that mango -// [3] =&gt; this mango +// [0] => the mango +// [1] => a mango +// [2] => that mango +// [3] => this mango // ) // an array of strings ordered from shorter to longer @@ -243,10 +254,10 @@ // outputs: // Array // ( -// [0] =&gt; small -// [1] =&gt; larger -// [2] =&gt; a big string -// [3] =&gt; it is a string thing +// [0] => small +// [1] => larger +// [2] => a big string +// [3] => it is a string thing // ) // sort it from longer to shorter @@ -255,11 +266,12 @@ // outputs: // Array // ( -// [0] =&gt; it is a string thing -// [1] =&gt; a big string -// [2] =&gt; larger -// [3] =&gt; small +// [0] => it is a string thing +// [1] => a big string +// [2] => larger +// [3] => small // ) +]]> </programlisting> </example> </para> @@ -294,17 +306,19 @@ <para> <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function foo() { $numargs = func_num_args(); - echo "Number of arguments: $numargs&lt;br&gt;\n"; - if ($numargs &gt;= 2) { - echo "Second argument is: " . func_get_arg (1) . "&lt;br&gt;\n"; + echo "Number of arguments: $numargs<br>\n"; + if ($numargs >= 2) { + echo "Second argument is: " . func_get_arg (1) . "<br>\n"; } } foo (1, 2, 3); -?&gt; +?> +]]> </programlisting> </informalexample> </para> @@ -346,21 +360,23 @@ <para> <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function foo() { $numargs = func_num_args(); - echo "Number of arguments: $numargs&lt;br&gt;\n"; - if ($numargs &gt;= 2) { - echo "Second argument is: " . func_get_arg (1) . "&lt;br&gt;\n"; + echo "Number of arguments: $numargs<br>\n"; + if ($numargs >= 2) { + echo "Second argument is: " . func_get_arg (1) . "<br>\n"; } $arg_list = func_get_args(); - for ($i = 0; $i &lt; $numargs; $i++) { - echo "Argument $i is: " . $arg_list[$i] . "&lt;br&gt;\n"; + for ($i = 0; $i < $numargs; $i++) { + echo "Argument $i is: " . $arg_list[$i] . "<br>\n"; } } foo (1, 2, 3); -?&gt; +?> +]]> </programlisting> </informalexample> </para> @@ -402,14 +418,16 @@ <para> <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function foo() { $numargs = func_num_args(); echo "Number of arguments: $numargs\n"; } foo (1, 2, 3); // Prints 'Number of arguments: 3' -?&gt; +?> +]]> </programlisting> </informalexample> </para> @@ -448,11 +466,13 @@ function name was found, &false; otherwise. <informalexample> <programlisting role="php"> +<![CDATA[ if (function_exists('imap_open')) { - echo "IMAP functions are available.&lt;br&gt;\n"; + echo "IMAP functions are available.<br>\n"; } else { - echo "IMAP functions are not available.&lt;br&gt;\n"; + echo "IMAP functions are not available.<br>\n"; } +]]> </programlisting> </informalexample> Note that a function name may exist, even if the function itself @@ -487,8 +507,9 @@ <varname>$arr["user"]</varname> (see example below). <informalexample> <programlisting role="php"> +<![CDATA[ function myrow($id, $data) { - return "&lt;tr&gt;&lt;th&gt;$id&lt;/th&gt;&lt;td&gt;$data&lt;/td&gt;&lt;/tr&gt;\n"; + return "<tr><th>$id</th><td>$data</td></tr>\n"; } $arr = get_defined_functions(); @@ -503,26 +524,27 @@ <programlisting> Array ( - [internal] =&gt; Array + [internal] => Array ( - [0] =&gt; zend_version - [1] =&gt; func_num_args - [2] =&gt; func_get_arg - [3] =&gt; func_get_args - [4] =&gt; strlen - [5] =&gt; strcmp - [6] =&gt; strncmp + [0] => zend_version + [1] => func_num_args + [2] => func_get_arg + [3] => func_get_args + [4] => strlen + [5] => strcmp + [6] => strncmp ... - [750] =&gt; bcscale - [751] =&gt; bccomp + [750] => bcscale + [751] => bccomp ) - [user] =&gt; Array + [user] => Array ( - [0] =&gt; myrow + [0] => myrow ) ) +]]> </programlisting> </informalexample> </para> Index: phpdoc/en/functions/gettext.xml diff -u phpdoc/en/functions/gettext.xml:1.13 phpdoc/en/functions/gettext.xml:1.14 --- phpdoc/en/functions/gettext.xml:1.13 Sat Nov 10 16:49:35 2001 +++ phpdoc/en/functions/gettext.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <reference id="ref.gettext"> <title>Gettext</title> <titleabbrev>gettext</titleabbrev> @@ -96,7 +96,8 @@ <example> <title><function>gettext</function>-check</title> <programlisting> -&lt;?php +<![CDATA[ +<?php // Set language to German putenv ("LANG=de"); @@ -109,6 +110,7 @@ // Print a test message print (gettext ("Welcome to My PHP Application")); ?> +]]> </programlisting> </example> </refsect1> Index: phpdoc/en/functions/gmp.xml diff -u phpdoc/en/functions/gmp.xml:1.16 phpdoc/en/functions/gmp.xml:1.17 --- phpdoc/en/functions/gmp.xml:1.16 Sat Nov 10 16:49:35 2001 +++ phpdoc/en/functions/gmp.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <reference id="ref.gmp"> <title>GMP functions</title> <titleabbrev>GMP</titleabbrev> @@ -51,7 +51,8 @@ <example> <title>Factorial function using GMP</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php function fact ($x) { if ($x &lt;= 1) return 1; @@ -60,7 +61,8 @@ } print gmp_strval (fact (1000)) . "\n"; -?&gt; +?> +]]> </programlisting> </example> </para> @@ -92,10 +94,12 @@ <example> <title>Creating GMP number</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $a = gmp_init (123456); $b = gmp_init ("0xFFFFDEBACDFEDF7200"); ?> +]]> </programlisting> </example> </para> @@ -164,10 +168,12 @@ <example> <title>Converting a GMP number to a string</title> <programlisting role="php"> +<![CDATA[ &lt;?php $a = gmp_init("0x41682179fbf5"); printf ("Decimal: %s, 36-based: %s", gmp_strval($a), gmp_strval($a,36)); ?> +]]> </programlisting> </example> </para> @@ -356,12 +362,14 @@ <example> <title>Division of GMP numbers</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $a = gmp_init ("0x41682179fbf5"); $res = gmp_div_qr ($a, "0xDEFE75"); printf("Result is: q - %s, r - %s", gmp_strval ($res[0]), gmp_strval ($res[1])); ?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/http.xml diff -u phpdoc/en/functions/http.xml:1.32 phpdoc/en/functions/http.xml:1.33 --- phpdoc/en/functions/http.xml:1.32 Sat Nov 10 16:49:35 2001 +++ phpdoc/en/functions/http.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.32 $ --> +<!-- $Revision: 1.33 $ --> <reference id="ref.http"> <title>HTTP functions</title> <titleabbrev>HTTP</titleabbrev> @@ -39,8 +39,10 @@ multiple headers of the same type. For example: <informalexample> <programlisting role="php"> +<![CDATA[ header('WWW-Authenticate: Negotiate'); header('WWW-Authenticate: NTLM',false); +]]> </programlisting> </informalexample> </para> @@ -51,10 +53,12 @@ (302) status code to the browser. <informalexample> <programlisting role="php"> +<![CDATA[ header("Location: http://www.php.net/"); /* Redirect browser to PHP web site */ exit; /* Make sure that code below does not get executed when we redirect. */ +]]> </programlisting> </informalexample> </para> @@ -69,9 +73,11 @@ relative one yourself: <informalexample> <programlisting> +<![CDATA[ header("Location: http://".$HTTP_SERVER_VARS['HTTP_HOST'] ."/".dirname($HTTP_SERVER_VARS['PHP_SELF']) ."/".$relative_url); +]]> </programlisting> </informalexample> </para> @@ -86,7 +92,9 @@ make sure that your script generates the proper status code. <informalexample> <programlisting role="php"> +<![CDATA[ header("HTTP/1.0 404 Not Found"); +]]> </programlisting> </informalexample> <note> @@ -96,7 +104,9 @@ <literal>Status</literal> header. <informalexample> <programlisting role="php"> +<![CDATA[ header("Status: 404 Not Found"); +]]> </programlisting> </informalexample> </para> @@ -109,12 +119,14 @@ caching with <informalexample> <programlisting role="php"> +<![CDATA[ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 +]]> </programlisting> </informalexample> <note> @@ -145,11 +157,13 @@ when using a single PHP/HTML file. <informalexample> <programlisting role="php"> -&lt;?php require("user_logging.inc") ?&gt; +<![CDATA[ +<?php require("user_logging.inc") ?> -&lt;?php header ("Content-type: audio/x-pn-realaudio"); ?&gt; +<?php header ("Content-type: audio/x-pn-realaudio"); ?> // Broken, Note the blank lines above +]]> </programlisting> </informalexample> <note> @@ -172,11 +186,13 @@ save dialog. <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php header("Content-type: application/pdf"); header("Content-Disposition: attachment; filename=downloaded.pdf"); /* ... output pdf file ... */ +]]> </programlisting> </informalexample> <note> @@ -299,9 +315,11 @@ <example> <title><function>setcookie</function> send examples</title> <programlisting role="php"> +<![CDATA[ setcookie ("TestCookie", "Test Value"); setcookie ("TestCookie", $value,time()+3600); /* expire in 1 hour */ setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", 1); +]]> </programlisting> </example> </para> @@ -310,10 +328,12 @@ <example> <title><function>setcookie</function> delete examples</title> <programlisting role="php"> +<![CDATA[ setcookie ("TestCookie"); // set the expiration date to one hour ago setcookie ("TestCookie", "", time() - 3600); setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", ".utoronto.ca", 1); +]]> </programlisting> </example> When deleting a cookie you should assure that the expiration date @@ -327,8 +347,10 @@ cookie in a script, simply use one of the following examples: <informalexample> <programlisting role="php"> +<![CDATA[ echo $TestCookie; echo $HTTP_COOKIE_VARS["TestCookie"]; +]]> </programlisting> </informalexample> </para> @@ -340,14 +362,16 @@ name: <informalexample> <programlisting role="php"> +<![CDATA[ setcookie ("cookie[three]", "cookiethree"); setcookie ("cookie[two]", "cookietwo"); setcookie ("cookie[one]", "cookieone"); if (isset ($cookie)) { while (list ($name, $value) = each ($cookie)) { - echo "$name == $value&lt;br>\n"; + echo "$name == $value<br>\n"; } } +]]> </programlisting> </informalexample> </para> Index: phpdoc/en/functions/hw.xml diff -u phpdoc/en/functions/hw.xml:1.20 phpdoc/en/functions/hw.xml:1.21 --- phpdoc/en/functions/hw.xml:1.20 Sat Nov 10 16:49:35 2001 +++ phpdoc/en/functions/hw.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.20 $ --> +<!-- $Revision: 1.21 $ --> <reference id="ref.hyperwave"> <title>Hyperwave functions</title> <titleabbrev>Hyperwave</titleabbrev> @@ -282,9 +282,13 @@ <systemitem role="url">http://your.hostname/name_of_object</systemitem> would return the object. The rewriting rule is quite easy: - <informalexample><programlisting role="apache-conf"> + <informalexample> + <programlisting role="apache-conf"> +<![CDATA[ RewriteRule ^/(.*) /usr/local/apache/htdocs/HyperWave/$1 [L] -</programlisting></informalexample> +]]> + </programlisting> + </informalexample> Now every URL relates to an object in the Hyperwave server. This causes a simple to solve problem. There is no way to execute a @@ -292,9 +296,13 @@ script. This can be fixed with another rewriting rule like the following: - <informalexample><programlisting role="apache-conf"> + <informalexample> + <programlisting role="apache-conf"> +<![CDATA[ RewriteRule ^/hw/(.*) /usr/local/apache/htdocs/hw/$1 [L] -</programlisting></informalexample> +]]> + </programlisting> + </informalexample> This will reserve the directory <filename class="directory">/usr/local/apache/htdocs/hw</filename> for additional scripts and other files. Just make sure this rule is @@ -305,9 +313,13 @@ them all in one directory. Finally, don't forget to turn on the rewriting engine with - <informalexample><programlisting role="apache-conf"> + <informalexample> + <programlisting role="apache-conf"> +<![CDATA[ RewriteEngine on -</programlisting></informalexample> +]]> + </programlisting> + </informalexample> My experiences have shown that you will need the following scripts: @@ -1707,11 +1719,13 @@ <example> <title>modifying an attribute</title> <programlisting role="php"> +<![CDATA[ // $connect is an existing connection to the Hyperwave server // $objid is the ID of the object to modify $remarr = array("Name" => "books"); $addarr = array("Name" => "articles"); $hw_modifyobject($connect, $objid, $remarr, $addarr); +]]> </programlisting> </example> In order to delete/add a name=value pair from/to the object record just @@ -1721,11 +1735,13 @@ <example> <title>adding a completely new attribute</title> <programlisting role="php"> +<![CDATA[ // $connect is an existing connection to the Hyperwave server // $objid is the ID of the object to modify $remarr = array("Name" => 0); $addarr = array("Name" => "articles"); $hw_modifyobject($connect, $objid, $remarr, $addarr); +]]> </programlisting> </example> </para> @@ -1742,18 +1758,22 @@ <example> <title>modifying Title attribute</title> <programlisting role="php"> +<![CDATA[ $remarr = array("Title" => "en:Books"); $addarr = array("Title" => "en:Articles"); $hw_modifyobject($connect, $objid, $remarr, $addarr); +]]> </programlisting> </example> or <example> <title>modifying Title attribute</title> <programlisting role="php"> +<![CDATA[ $remarr = array("Title" => array("en" => "Books")); $addarr = array("Title" => array("en" => "Articles", "ge"=>"Artikel")); $hw_modifyobject($connect, $objid, $remarr, $addarr); +]]> </programlisting> </example> This removes the english title 'Books' and adds the english title @@ -1761,9 +1781,11 @@ <example> <title>removing attribute</title> <programlisting role="php"> +<![CDATA[ $remarr = array("Title" => ""); $addarr = array("Title" => "en:Articles"); $hw_modifyobject($connect, $objid, $remarr, $addarr); +]]> </programlisting> </example> <note> Index: phpdoc/en/functions/ibase.xml diff -u phpdoc/en/functions/ibase.xml:1.32 phpdoc/en/functions/ibase.xml:1.33 --- phpdoc/en/functions/ibase.xml:1.32 Sat Nov 10 16:49:35 2001 +++ phpdoc/en/functions/ibase.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.32 $ --> +<!-- $Revision: 1.33 $ --> <reference id="ref.ibase"> <title>InterBase functions</title> <titleabbrev>InterBase</titleabbrev> @@ -21,7 +21,9 @@ <filename>php.ini</filename> the following directive: <informalexample> <programlisting> +<![CDATA[ magic_quotes_sybase = On +]]> </programlisting> </informalexample> </para> @@ -87,7 +89,8 @@ <example> <title><function>ibase_connect</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $dbh = ibase_connect ($host, $username, $password); $stmt = 'SELECT * FROM tblname'; $sth = ibase_query ($dbh, $stmt); @@ -96,6 +99,7 @@ } ibase_close ($dbh); ?> +]]> </programlisting> </example> </para> @@ -303,7 +307,8 @@ <function>ibase_execute</function>. <informalexample> <programlisting role="php"> -&lt;php +<![CDATA[ +<php $dbh = ibase_connect ($host, $username, $password); $stmt = 'SELECT * FROM tblname'; $sth = ibase_query ($dbh, $stmt); @@ -312,6 +317,7 @@ } ibase_close ($dbh); ?> +]]> </programlisting> </informalexample> </para> @@ -343,6 +349,7 @@ relation, length, type. <informalexample> <programlisting role="php"> +<![CDATA[ // helio@helio.com.br 08-Dec-2000 02:53 $rs=ibase_query("Select * from something"); @@ -355,6 +362,7 @@ echo "length: ".$col_info['length']."\n"; echo "type: ".$col_info['type']."\n"; } +]]> </programlisting> </informalexample> </para> @@ -434,7 +442,8 @@ some parameters changing. <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $updates = array( 1 => 'Eric', 5 => 'Filip', @@ -447,6 +456,7 @@ ibase_execute($query, $bar, $baz); } ?> +]]> </programlisting> </informalexample> </para> @@ -577,11 +587,13 @@ defaults to IBASE_TIMESTAMP for backwards compatibility. <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // InterBase 6 TIME-type columns will be returned in // the form '05 hours 37 minutes'. ibase_timefmt("%H hours %M minutes", IBASE_TIME); ?> +]]> </programlisting> </informalexample> </para> @@ -627,7 +639,8 @@ set. <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $dbh = ibase_connect ($host, $username, $password); $stmt = 'SELECT * FROM tblname'; $sth = ibase_query ($dbh, $stmt); @@ -642,6 +655,7 @@ ibase_close ($dbh); ?> +]]> </programlisting> </informalexample> </para> Index: phpdoc/en/functions/iconv.xml diff -u phpdoc/en/functions/iconv.xml:1.8 phpdoc/en/functions/iconv.xml:1.9 --- phpdoc/en/functions/iconv.xml:1.8 Sat Nov 10 16:49:36 2001 +++ phpdoc/en/functions/iconv.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <reference id="ref.iconv"> <title>iconv functions</title> <titleabbrev>iconv</titleabbrev> @@ -49,7 +49,9 @@ <example> <title><function>iconv</function> example:</title> <programlisting role="php"> +<![CDATA[ echo iconv("ISO-8859-1","UTF-8","This is test."); +]]> </programlisting> </example> </para> @@ -111,8 +113,10 @@ <example> <title><function>iconv_set_encoding</function> example:</title> <programlisting role="php"> +<![CDATA[ iconv_set_encoding("internal_encoding", "UTF-8"); iconv_set_encoding("output_encoding", "ISO-8859-1"); +]]> </programlisting> </example> </para> @@ -159,7 +163,9 @@ <example> <title><function>ob_iconv_handler</function> example:</title> <programlisting role="php"> +<![CDATA[ ob_start("ob_iconv_handler"); // start output buffering +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/ifx.xml diff -u phpdoc/en/functions/ifx.xml:1.22 phpdoc/en/functions/ifx.xml:1.23 --- phpdoc/en/functions/ifx.xml:1.22 Mon Nov 12 12:11:19 2001 +++ phpdoc/en/functions/ifx.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.22 $ --> +<!-- $Revision: 1.23 $ --> <reference id="ref.ifx"> <title>Informix functions</title> <titleabbrev>Informix</titleabbrev> @@ -212,8 +212,10 @@ <function>ifx_close</function>. <example> <title>Connect to a Informix database</title> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ $conn_id = ifx_connect ("mydb@ol_srv1", "imyself", "mypassword"); +]]> </programlisting> </example> </para> @@ -310,10 +312,12 @@ <function>ifx_pconnect</function>. <example> <title>Closing a Informix connection</title> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ $conn_id = ifx_connect ("mydb@ol_srv", "itsme", "mypassword"); ... some queries and stuff ... ifx_close($conn_id); +]]> </programlisting> </example> </para> @@ -401,22 +405,25 @@ <title> Show all rows of the "orders" table as a html table </title> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ ifx_textasvarchar(1); // use "text mode" for blobs $res_id = ifx_query("select * from orders", $conn_id); if (! $res_id) { - printf("Can't select orders : %s\n&lt;br>%s&lt;br>\n", ifx_error()); + printf("Can't select orders : %s\n<br>%s<br>\n", ifx_error()); ifx_errormsg(); die; } ifx_htmltbl_result($res_id, "border=\"1\""); ifx_free_result($res_id); +]]> </programlisting> </example> <example> <title>Insert some values into the "catalog" table</title> - <programlisting role="php3"> - // create blob id's for a byte and text column + <programlisting role="php"> +<![CDATA[ + // create blob id's for a byte and text column $textid = ifx_create_blob(0, 0, "Text column in memory"); $byteid = ifx_create_blob(1, 0, "Byte column in memory"); // store blob id's in a blobid array @@ -431,6 +438,7 @@ } // free result id ifx_free_result($res_id); +]]> </programlisting> </example> </para> @@ -618,8 +626,10 @@ See also: <function>ifx_error</function> </para> <informalexample> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ printf("%s\n&lt;br>", ifx_errormsg(-201)); +]]> </programlisting> </informalexample> </refsect1> @@ -665,7 +675,8 @@ </para> <example> <title>Informix affected rows</title> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ $rid = ifx_prepare ("select * from emp where name like " . $name, $connid); if (! $rid) { @@ -673,9 +684,10 @@ } $rowcount = ifx_affected_rows ($rid); if ($rowcount > 1000) { - printf ("Too many rows in result set (%d)\n&lt;br>", $rowcount); - die ("Please restrict your query&lt;br>\n"); + printf ("Too many rows in result set (%d)\n<br>", $rowcount); + die ("Please restrict your query<br>\n"); } +]]> </programlisting> </example> </refsect1> @@ -719,7 +731,8 @@ </para> <example> <title>Retrieve Informix sqlca.sqlerrd[x] values</title> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ /* assume the first column of 'sometable' is a serial */ $qid = ifx_query("insert into sometable values (0, '2nd column', 'another column') ", $connid); @@ -728,7 +741,8 @@ } $sqlca = ifx_getsqlca ($qid); $serial_value = $sqlca["sqlerrd1"]; -echo "The serial value of the inserted row is : " . $serial_value&lt;br>\n"; +echo "The serial value of the inserted row is : " . $serial_value<br>\n"; +]]> </programlisting> </example> </refsect1> @@ -785,7 +799,8 @@ </para> <example> <title>Informix fetch rows</title> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ $rid = ifx_prepare ("select * from emp where name like " . $name, $connid, IFX_SCROLL); if (! $rid) { @@ -793,8 +808,8 @@ } $rowcount = ifx_affected_rows($rid); if ($rowcount > 1000) { - printf ("Too many rows in result set (%d)\n&lt;br>", $rowcount); - die ("Please restrict your query&lt;br>\n"); + printf ("Too many rows in result set (%d)\n<br>", $rowcount); + die ("Please restrict your query<br>\n"); } if (! ifx_do ($rid)) { ... error ... @@ -805,10 +820,11 @@ $fieldvalue = $row[$fieldname]; printf ("%s = %s,", $fieldname, $fieldvalue); } - printf("\n&lt;br>"); + printf("\n<br>"); $row = ifx_fetch_row ($rid, "NEXT"); } ifx_free_result ($rid); +]]> </programlisting> </example> </refsect1> @@ -842,7 +858,8 @@ </para> <example> <title>Informix results as HTML table</title> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ $rid = ifx_prepare ("select * from emp where name like " . $name, $connid, IFX_SCROLL); if (! $rid) { @@ -850,8 +867,8 @@ } $rowcount = ifx_affected_rows ($rid); if ($rowcount > 1000) { - printf ("Too many rows in result set (%d)\n&lt;br>", $rowcount); - die ("Please restrict your query&lt;br>\n"); + printf ("Too many rows in result set (%d)\n<br>", $rowcount); + die ("Please restrict your query<br>\n"); } if (! ifx_do($rid) { ... error ... @@ -860,6 +877,7 @@ ifx_htmltbl_result ($rid, "border=\"2\""); ifx_free_result($rid); +]]> </programlisting> </example> </refsect1> @@ -885,16 +903,18 @@ </para> <example> <title>Fielnames and SQL fieldtypes</title> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ $types = ifx_fieldtypes ($resultid); if (! isset ($types)) { ... error ... } -for ($i = 0; $i &lt; count($types); $i++) { +for ($i = 0; $i < count($types); $i++) { $fname = key($types); printf("%s :\t type = %s\n", $fname, $types[$fname]); next($types); } +]]> </programlisting> </example> </refsect1> @@ -926,16 +946,18 @@ </para> <example> <title>Informix SQL fieldproperties</title> - <programlisting role="php3"> + <programlisting role="php"> +<![CDATA[ $properties = ifx_fieldproperties ($resultid); if (! isset($properties)) { ... error ... } -for ($i = 0; $i &lt; count($properties); $i++) { +for ($i = 0; $i < count($properties); $i++) { $fname = key ($properties); printf ("%s:\t type = %s\n", $fname, $properties[$fname]); next ($properties); } +]]> </programlisting> </example> </refsect1> Index: phpdoc/en/functions/image.xml diff -u phpdoc/en/functions/image.xml:1.61 phpdoc/en/functions/image.xml:1.62 --- phpdoc/en/functions/image.xml:1.61 Sun Nov 11 08:40:28 2001 +++ phpdoc/en/functions/image.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.61 $ --> +<!-- $Revision: 1.62 $ --> <reference id="ref.image"> <title>Image functions</title> <titleabbrev>Image</titleabbrev> @@ -69,8 +69,10 @@ <example> <title>GetImageSize (file)</title> <programlisting role="php"> -&lt;?php $size = GetImageSize ("img/flag.jpg"); ?> -&lt;IMG SRC="img/flag.jpg" &lt;?php echo $size[3]; ?> +<![CDATA[ +<?php $size = GetImageSize ("img/flag.jpg"); ?> +<IMG SRC="img/flag.jpg" <?php echo $size[3]; ?> +]]> </programlisting> </example> </para> @@ -78,7 +80,9 @@ <example> <title>GetImageSize (URL)</title> <programlisting role="php"> -&lt;?php $size = GetImageSize ("http://www.php.net/gifs/logo.gif"); ?> +<![CDATA[ +<?php $size = GetImageSize ("http://www.php.net/gifs/logo.gif"); ?> +]]> </programlisting> </example> </para> @@ -107,13 +111,15 @@ <example> <title>GetImageSize returning IPTC</title> <programlisting> -&lt;?php +<![CDATA[ +<?php $size = GetImageSize ("testimg.jpg",&amp;$info); if (isset ($info["APP13"])) { $iptc = iptcparse ($info["APP13"]); var_dump ($iptc); } -?&gt; +?> +]]> </programlisting> </example> <note> @@ -447,8 +453,10 @@ by <parameter>im</parameter>. <informalexample> <programlisting role="php"> +<![CDATA[ $white = ImageColorAllocate ($im, 255, 255, 255); $black = ImageColorAllocate ($im, 0, 0, 0); +]]> </programlisting> </informalexample> </para> @@ -483,8 +491,10 @@ <function>ImageColorAllocate</function> function. <informalexample> <programlisting role="php"> +<![CDATA[ $white = ImageColorAllocate($im, 255, 255, 255); ImageColorDeAllocate($im, $white); +]]> </programlisting> </informalexample> </para> @@ -1103,7 +1113,8 @@ Creating a new GD image stream and outputting an image. </title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php header ("Content-type: image/png"); $im = @ImageCreate (50, 100) or die ("Cannot Initialize new GD image stream"); @@ -1112,6 +1123,7 @@ ImageString ($im, 1, 5, 5, "A Simple Text String", $text_color); ImagePng ($im); ?> +]]> </programlisting> </example> </para> @@ -1210,6 +1222,7 @@ vic@zymsys.com) </title> <programlisting role="php"> +<![CDATA[ function LoadGif ($imgname) { $im = @ImageCreateFromGIF ($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ @@ -1222,6 +1235,7 @@ } return $im; } +]]> </programlisting> </example> <note> @@ -1263,6 +1277,7 @@ vic@zymsys.com ) </title> <programlisting role="php"> +<![CDATA[ function LoadJpeg ($imgname) { $im = @ImageCreateFromJPEG ($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ @@ -1275,6 +1290,7 @@ } return $im; } +]]> </programlisting> </example> </para> @@ -1309,6 +1325,7 @@ vic@zymsys.com) </title> <programlisting role="php"> +<![CDATA[ function LoadPNG ($imgname) { $im = @ImageCreateFromPNG ($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ @@ -1321,6 +1338,7 @@ } return $im; } +]]> </programlisting> </example> </para> @@ -1355,6 +1373,7 @@ vic@zymsys.com) </title> <programlisting role="php"> +<![CDATA[ function LoadWBMP ($imgname) { $im = @ImageCreateFromWBMP ($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ @@ -1367,6 +1386,7 @@ } return $im; } +]]> </programlisting> </example> <note> @@ -1689,7 +1709,8 @@ ImageGIF($im);</literal> by the more flexible sequence: <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php if (function_exists("imagegif")) { Header("Content-type: image/gif"); ImageGIF($im); @@ -1708,7 +1729,8 @@ } else die("No image support in this PHP server"); -?&gt; +?> +]]> </programlisting> </informalexample> </para> @@ -1721,12 +1743,15 @@ the presence of the various supported image formats: <informalexample> <programlisting role="php"> +<![CDATA[ if (ImageTypes() &amp; IMG_GIF) { Header("Content-type: image/gif"); ImageGif($im); } elseif (ImageTypes() &amp; IMG_JPG) { - ... etc.</programlisting> + ... etc. +]]> + </programlisting> </informalexample> </para> </note> @@ -1763,10 +1788,12 @@ <parameter>filename</parameter> it outputs the image to the file. <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $im = ImageCreateFromPng("test.png"); ImagePng($im); ?> +]]> </programlisting> </informalexample> </para> @@ -2284,7 +2311,8 @@ </para> <para> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php Header ("Content-type: image/jpeg"); $im = ImageCreate (350, 45); $black = ImageColorAllocate ($im, 0, 0, 0); @@ -2296,7 +2324,8 @@ ImagePsFreeFont($font); ImageJpeg($im, "", 100);//for best quality... your mileage may vary ImageDestroy ($im); -?&gt; +?> +]]> </programlisting> </para> <para> @@ -2603,7 +2632,8 @@ <example> <title>ImageSetStyle</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php Header ("Content-type: image/png"); $im = imagecreate (100, 100); $w = ImageColorAllocate ($im, 255, 255, 255); @@ -2625,7 +2655,8 @@ ImagePng($im); ImageDestroy ($im); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -2993,7 +3024,8 @@ <example> <title>ImageTTFText</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php Header ("Content-type: image/gif"); $im = imagecreate (400, 30); $black = ImageColorAllocate ($im, 0, 0, 0); @@ -3002,7 +3034,8 @@ "Testing... Omega: &amp;#937;"); ImageGif ($im); ImageDestroy ($im); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -3039,11 +3072,13 @@ <example> <title>ImageTypes</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php if (ImageTypes() &amp; IMG_PNG) { echo "PNG Support is enabled"; } -?&gt; +?> +]]> </programlisting> </example> </para> @@ -3153,10 +3188,11 @@ <example> <title>read_exif_data</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $exif = read_exif_data ('p0001807.jpg'); while(list($k,$v)=each($exif)) { - echo "$k: $v&lt;br>\n"; + echo "$k: $v<br>\n"; } ?> @@ -3181,6 +3217,7 @@ RawFocusDistance: 16.659999847412 Orientation: 1 ExifVersion: 0200 +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/imap.xml diff -u phpdoc/en/functions/imap.xml:1.52 phpdoc/en/functions/imap.xml:1.53 --- phpdoc/en/functions/imap.xml:1.52 Sat Nov 10 16:49:36 2001 +++ phpdoc/en/functions/imap.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.52 $ --> +<!-- $Revision: 1.53 $ --> <reference id='ref.imap'> <title>IMAP, POP3 and NNTP functions</title> <titleabbrev>IMAP</titleabbrev> @@ -180,6 +180,7 @@ <example> <title><function>imap_append</function> example</title> <programlisting role="php"> +<![CDATA[ $stream = imap_open("{your.imap.host}INBOX.Drafts","username", "password"); $check = imap_check($stream); @@ -197,6 +198,7 @@ print "Msg Count after append : ". $check->Nmsgs."\n"; imap_close($stream); +]]> </programlisting> </example> </para> @@ -454,6 +456,7 @@ <example> <title><function>imap_createmailbox</function> example</title> <programlisting> +<![CDATA[ $mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN) or die("can't connect: ".imap_last_error()); @@ -462,7 +465,7 @@ $newname = $name1; -echo "Newname will be '$name1'&lt;br>\n"; +echo "Newname will be '$name1'<br>\n"; # we will now create a new mailbox "phptestbox" in your inbox folder, # check its status after creation and finaly remove it to restore @@ -470,33 +473,34 @@ if(@imap_createmailbox($mbox,imap_utf7_encode("{your.imap.host}INBOX.$newname"))) { $status = @imap_status($mbox,"{your.imap.host}INBOX.$newname",SA_ALL); if($status) { - print("your new mailbox '$name1' has the following status:&lt;br>\n"); - print("Messages: ". $status->messages )."&lt;br>\n"; - print("Recent: ". $status->recent )."&lt;br>\n"; - print("Unseen: ". $status->unseen )."&lt;br>\n"; - print("UIDnext: ". $status->uidnext )."&lt;br>\n"; - print("UIDvalidity:". $status->uidvalidity)."&lt;br>\n"; + print("your new mailbox '$name1' has the following status:<br>\n"); + print("Messages: ". $status->messages )."<br>\n"; + print("Recent: ". $status->recent )."<br>\n"; + print("Unseen: ". $status->unseen )."<br>\n"; + print("UIDnext: ". $status->uidnext )."<br>\n"; + print("UIDvalidity:". $status->uidvalidity)."<br>\n"; if(imap_renamemailbox($mbox,"{your.imap.host}INBOX.$newname","{your.imap.host}INBOX.$name2")) { - echo "renamed new mailbox from '$name1' to '$name2'&lt;br>\n"; + echo "renamed new mailbox from '$name1' to '$name2'<br>\n"; $newname=$name2; } else { - print "imap_renamemailbox on new mailbox failed: ".imap_last_error()."&lt;br>\n"; + print "imap_renamemailbox on new mailbox failed: ".imap_last_error()."<br>\n"; } } else { - print "imap_status on new mailbox failed: ".imap_last_error()."&lt;br>\n"; + print "imap_status on new mailbox failed: ".imap_last_error()."<br>\n"; } if(@imap_deletemailbox($mbox,"{your.imap.host}INBOX.$newname")) { - print "new mailbox removed to restore initial state&lt;br>\n"; + print "new mailbox removed to restore initial state<br>\n"; } else { - print "imap_deletemailbox on new mailbox failed: ".implode("&lt;br>\n",imap_errors())."&lt;br>\n"; + print "imap_deletemailbox on new mailbox failed: ".implode("<br>\n",imap_errors())."<br>\n"; } } else { - print "could not create new mailbox: ".implode("&lt;br>\n",imap_errors())."&lt;br>\n"; + print "could not create new mailbox: ".implode("<br>\n",imap_errors())."<br>\n"; } imap_close($mbox); +]]> </programlisting> </example> </para> @@ -541,18 +545,20 @@ <example> <title><function>imap_delete</function> Beispiel</title> <programlisting role="php"> +<![CDATA[ $mbox = imap_open ("{your.imap.host}INBOX", "username", "password") or die ("can't connect: " . imap_last_error()); $check = imap_mailboxmsginfo ($mbox); -print "Messages before delete: " . $check->Nmsgs . "&lt;br>\n" ; +print "Messages before delete: " . $check->Nmsgs . "<br>\n" ; imap_delete ($mbox, 1); $check = imap_mailboxmsginfo ($mbox); -print "Messages after delete: " . $check->Nmsgs . "&lt;br>\n" ; +print "Messages after delete: " . $check->Nmsgs . "<br>\n" ; imap_expunge ($mbox); $check = imap_mailboxmsginfo ($mbox); -print "Messages after expunge: " . $check->Nmsgs . "&lt;br>\n" ; +print "Messages after expunge: " . $check->Nmsgs . "<br>\n" ; imap_close ($mbox); +]]> </programlisting> </example> </para> @@ -744,6 +750,7 @@ <example> <title><function>imap_fetch_overview</function> example</title> <programlisting role="php"> +<![CDATA[ $mbox = imap_open("{your.imap.host:143}","username","password") or die("can't connect: ".imap_last_error()); @@ -760,6 +767,7 @@ } imap_close($mbox); +]]> </programlisting> </example> </para> @@ -1072,6 +1080,7 @@ <example> <title><function>imap_get_quota</function> example</title> <programlisting role="php"> +<![CDATA[ $mbox = imap_open("{your.imap.host}","mailadmin","password",OP_HALFOPEN) or die("can't connect: ".imap_last_error()); @@ -1082,6 +1091,7 @@ } imap_close($mbox); +]]> </programlisting> </example> </para> @@ -1170,6 +1180,7 @@ <example> <title><function>imap_getmailboxes</function> example</title> <programlisting role="php"> +<![CDATA[ $mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN) or die("can't connect: ".imap_last_error()); @@ -1181,12 +1192,13 @@ print "($key) "; print imap_utf7_decode($val->name).","; print "'".$val->delimiter."',"; - print $val->attributes."&lt;br>\n"; + print $val->attributes."<br>\n"; } } else print "imap_getmailboxes failed: ".imap_last_error()."\n"; imap_close($mbox); +]]> </programlisting> </example> </para> @@ -1442,6 +1454,7 @@ <example> <title><function>imap_listmailbox</function> example</title> <programlisting role="php"> +<![CDATA[ $mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN) or die("can't connect: ".imap_last_error()); @@ -1449,11 +1462,12 @@ if(is_array($list)) { reset($list); while (list($key, $val) = each($list)) - print imap_utf7_decode($val)."&lt;br>\n"; + print imap_utf7_decode($val)."<br>\n"; } else print "imap_listmailbox failed: ".imap_last_error()."\n"; imap_close($mbox); +]]> </programlisting> </example> </para> @@ -1544,7 +1558,8 @@ <example> <title><function>imap_mail_compose</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $envelope["from"]="musone@afterfive.com"; $envelope["to"]="musone@darkstar"; @@ -1575,7 +1590,8 @@ echo nl2br(imap_mail_compose($envelope,$body)); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -1738,7 +1754,8 @@ <example> <title><function>imap_mailboxmsginfo</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $mbox = imap_open("{your.imap.host}INBOX","username", "password") or die("can't connect: ".imap_last_error()); @@ -1746,21 +1763,22 @@ $check = imap_mailboxmsginfo($mbox); if($check) { - print "Date: " . $check->Date ."&lt;br>\n" ; - print "Driver: " . $check->Driver ."&lt;br>\n" ; - print "Mailbox: " . $check->Mailbox ."&lt;br>\n" ; - print "Messages: ". $check->Nmsgs ."&lt;br>\n" ; - print "Recent: " . $check->Recent ."&lt;br>\n" ; - print "Unread: " . $check->Unread ."&lt;br>\n" ; - print "Deleted: " . $check->Deleted ."&lt;br>\n" ; - print "Size: " . $check->Size ."&lt;br>\n" ; + print "Date: " . $check->Date ."<br>\n" ; + print "Driver: " . $check->Driver ."<br>\n" ; + print "Mailbox: " . $check->Mailbox ."<br>\n" ; + print "Messages: ". $check->Nmsgs ."<br>\n" ; + print "Recent: " . $check->Recent ."<br>\n" ; + print "Unread: " . $check->Unread ."<br>\n" ; + print "Deleted: " . $check->Deleted ."<br>\n" ; + print "Size: " . $check->Size ."<br>\n" ; } else { - print "imap_check() failed: ".imap_last_error(). "&lt;br>\n"; + print "imap_check() failed: ".imap_last_error(). "<br>\n"; } imap_close($mbox); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -1794,14 +1812,15 @@ <example> <title><function>imap_mime_header_decode</function> example</title> <programlisting role="php"> -$text="=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= &lt;keld@dkuug.dk>"; +<![CDATA[ +$text="=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>"; $elements=imap_mime_header_decode($text); -for($i=0;$i&lt;count($elements);$i++) { +for($i=0;$i<count($elements);$i++) { echo "Charset: {$elements[$i]->charset}\n"; echo "Text: {$elements[$i]->text}\n\n"; } - +]]> </programlisting> </example> </para> @@ -1954,33 +1973,43 @@ local machine, do the following: <informalexample> <programlisting role="php"> +<![CDATA[ $mbox = imap_open ("{localhost:143}INBOX", "user_id", "password"); +]]> </programlisting> </informalexample> To connect to a POP3 server on port 110 on the local server, use: <informalexample> <programlisting role="php"> +<![CDATA[ $mbox = imap_open ("{localhost:110/pop3}INBOX", "user_id", "password"); +]]> </programlisting> </informalexample> To connect to an SSL IMAP or POP3 server, add /ssl after the protocol specification: <informalexample> <programlisting role="php"> +<![CDATA[ $mbox = imap_open ("{localhost:993/imap/ssl}INBOX", "user_id", "password"); +]]> </programlisting> </informalexample> To connect to an SSL IMAP or POP3 server with a self-signed certificate, add /ssl/novalidate-cert after the protocol specification: <informalexample> <programlisting role="php"> +<![CDATA[ $mbox = imap_open ("{localhost:995/pop3/ssl/novalidate-cert}", "user_id", "password"); +]]> </programlisting> </informalexample> To connect to an NNTP server on port 119 on the local server, use: <informalexample> <programlisting role="php"> +<![CDATA[ $nntp = imap_open ("{localhost:119/nntp}comp.test", "", ""); +]]> </programlisting> </informalexample> To connect to a remote server replace "localhost" with the name @@ -1990,31 +2019,33 @@ <example> <title><function>imap_open</function> example</title> <programlisting role="php"> +<![CDATA[ $mbox = imap_open ("{your.imap.host:143}", "username", "password"); -echo "&lt;p>&lt;h1>Mailboxes&lt;/h1>\n"; +echo "<p><h1>Mailboxes</h1>\n"; $folders = imap_listmailbox ($mbox, "{your.imap.host:143}", "*"); if ($folders == false) { - echo "Call failed&lt;br>\n"; + echo "Call failed<br>\n"; } else { while (list ($key, $val) = each ($folders)) { - echo $val."&lt;br>\n"; + echo $val."<br>\n"; } } -echo "&lt;p>&lt;h1>Headers in INBOX&lt;/h1>\n"; +echo "<p><h1>Headers in INBOX</h1>\n"; $headers = imap_headers ($mbox); if ($headers == false) { - echo "Call failed&lt;br>\n"; + echo "Call failed<br>\n"; } else { while (list ($key,$val) = each ($headers)) { - echo $val."&lt;br>\n"; + echo $val."<br>\n"; } } imap_close($mbox); +]]> </programlisting> </example> </para> @@ -2215,17 +2246,19 @@ <example> <title><function>imap_rfc822_parse_adrlist</function> example</title> <programlisting role="php"> -$address_string = "Hartmut Holzgraefe &lt;hartmut@cvs.php.net>, postmaster@somedomain.net, root"; +<![CDATA[ +$address_string = "Hartmut Holzgraefe <hartmut@cvs.php.net>, postmaster@somedomain.net, root"; $address_array = imap_rfc822_parse_adrlist($address_string,"somedomain.net"); if(! is_array($address_array)) die("somethings wrong\n"); reset($address_array); while(list($key,$val)=each($address_array)){ - print "mailbox : ".$val->mailbox."&lt;br>\n"; - print "host : ".$val->host."&lt;br>\n"; - print "personal: ".$val->personal."&lt;br>\n"; - print "adl : ".$val->adl."&lt;p>\n"; + print "mailbox : ".$val->mailbox."<br>\n"; + print "host : ".$val->host."<br>\n"; + print "personal: ".$val->personal."<br>\n"; + print "adl : ".$val->adl."<p>\n"; } +]]> </programlisting> </example> </para> @@ -2285,7 +2318,9 @@ <example> <title><function>imap_rfc822_write_address</function> example</title> <programlisting role="php"> +<![CDATA[ print imap_rfc822_write_address("hartmut","cvs.php.net","Hartmut Holzgraefe")."\n"; +]]> </programlisting> </example> </para> @@ -2527,6 +2562,7 @@ <example> <title><function>imap_set_quota</function> example</title> <programlisting role="php"> +<![CDATA[ $mbox = imap_open ("{your.imap.host:143}", "mailadmin", "password"); if(!imap_set_quota($mbox, "user.kalowsky", 3000)) { @@ -2535,6 +2571,7 @@ } imap_close($mbox); +]]> </programlisting> </example> </para> @@ -2583,6 +2620,7 @@ <example> <title><function>imap_setflag_full</function> example</title> <programlisting role="php"> +<![CDATA[ $mbox = imap_open("{your.imap.host:143}","username","password") or die("can't connect: ".imap_last_error()); @@ -2592,6 +2630,7 @@ print $status."\n"; imap_close($mbox); +]]> </programlisting> </example> </para> @@ -2714,20 +2753,22 @@ <example> <title><function>imap_status</function> example</title> <programlisting role="php"> +<![CDATA[ $mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN) or die("can't connect: ".imap_last_error()); $status = imap_status($mbox,"{your.imap.host}INBOX",SA_ALL); if($status) { - print("Messages: ". $status->messages )."&lt;br>\n"; - print("Recent: ". $status->recent )."&lt;br>\n"; - print("Unseen: ". $status->unseen )."&lt;br>\n"; - print("UIDnext: ". $status->uidnext )."&lt;br>\n"; - print("UIDvalidity:". $status->uidvalidity)."&lt;br>\n"; + print("Messages: ". $status->messages )."<br>\n"; + print("Recent: ". $status->recent )."<br>\n"; + print("Unseen: ". $status->unseen )."<br>\n"; + print("UIDnext: ". $status->uidnext )."<br>\n"; + print("UIDvalidity:". $status->uidvalidity)."<br>\n"; } else print "imap_status failed: ".imap_last_error()."\n"; imap_close($mbox); +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/info.xml diff -u phpdoc/en/functions/info.xml:1.75 phpdoc/en/functions/info.xml:1.76 --- phpdoc/en/functions/info.xml:1.75 Sun Nov 11 07:40:25 2001 +++ phpdoc/en/functions/info.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.75 $ --> +<!-- $Revision: 1.76 $ --> <reference id="ref.info"> <title>PHP options &amp; information</title> <titleabbrev>PHP options/info</titleabbrev> @@ -72,7 +72,8 @@ <example> <title>Handle a failed assertion with a custom handler</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // Active assert and make it quiet assert_options (ASSERT_ACTIVE, 1); assert_options (ASSERT_WARNING, 0); @@ -80,10 +81,10 @@ // Create a handler function function my_assert_handler ($file, $line, $code) { - echo "&lt;hr&gt;Assertion Failed: - File '$file'&lt;br&gt; - Line '$line'&lt;br&gt; - Code '$code'&lt;br&gt;&lt;hr&gt;"; + echo "<hr>Assertion Failed: + File '$file'<br> + Line '$line'<br> + Code '$code'<br><hr>"; } // Set up the callback @@ -91,7 +92,8 @@ // Make an assertion that should fail assert ('mysql_query ("")'); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -244,7 +246,9 @@ <parameter>varname</parameter>, or &false; on an error. <informalexample> <programlisting> +<![CDATA[ $ip = getenv ("REMOTE_ADDR"); // get the ip number of the user +]]> </programlisting> </informalexample> </para> @@ -356,28 +360,32 @@ For example the line below <informalexample> <programlisting> +<![CDATA[ print_r (get_defined_constants()); +]]> </programlisting> </informalexample> will print a list like: <informalexample> <programlisting> +<![CDATA[ Array ( - [E_ERROR] =&gt; 1 - [E_WARNING] =&gt; 2 - [E_PARSE] =&gt; 4 - [E_NOTICE] =&gt; 8 - [E_CORE_ERROR] =&gt; 16 - [E_CORE_WARNING] =&gt; 32 - [E_COMPILE_ERROR] =&gt; 64 - [E_COMPILE_WARNING] =&gt; 128 - [E_USER_ERROR] =&gt; 256 - [E_USER_WARNING] =&gt; 512 - [E_USER_NOTICE] =&gt; 1024 - [E_ALL] =&gt; 2047 - [TRUE] =&gt; 1 + [E_ERROR] => 1 + [E_WARNING] => 2 + [E_PARSE] => 4 + [E_NOTICE] => 8 + [E_CORE_ERROR] => 16 + [E_CORE_WARNING] => 32 + [E_COMPILE_ERROR] => 64 + [E_COMPILE_WARNING] => 128 + [E_USER_ERROR] => 256 + [E_USER_WARNING] => 512 + [E_USER_NOTICE] => 1024 + [E_ALL] => 2047 + [TRUE] => 1 ) +]]> </programlisting> </informalexample> </para> @@ -411,8 +419,10 @@ For example the lines below <informalexample> <programlisting> +<![CDATA[ print_r (get_extension_funcs (&quot;xml&quot;)); print_r (get_extension_funcs (&quot;gd&quot;)); +]]> </programlisting> </informalexample> will print a list of the functions in the modules @@ -479,7 +489,8 @@ <example> <title><function>get_included_files</function> Example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php include("test1.php"); include_once("test2.php"); @@ -492,16 +503,19 @@ echo "$filename\n"; } -?&gt; +?> +]]> </programlisting> </example> will generate the following output: <informalexample> <programlisting> +<![CDATA[ test1.php test2.php test3.php test4.php +]]> </programlisting> </informalexample> </para> @@ -549,27 +563,31 @@ For example the line below <informalexample> <programlisting> +<![CDATA[ print_r (get_loaded_extensions()); +]]> </programlisting> </informalexample> will print a list like: <informalexample> <programlisting> +<![CDATA[ Array ( - [0] =&gt; xml - [1] =&gt; wddx - [2] =&gt; standard - [3] =&gt; session - [4] =&gt; posix - [5] =&gt; pgsql - [6] =&gt; pcre - [7] =&gt; gd - [8] =&gt; ftp - [9] =&gt; db - [10] =&gt; Calendar - [11] =&gt; bcmath + [0] => xml + [1] => wddx + [2] => standard + [3] => session + [4] => posix + [5] => pgsql + [6] => pcre + [7] => gd + [8] => ftp + [9] => db + [10] => Calendar + [11] => bcmath ) +]]> </programlisting> </informalexample> </para> @@ -656,8 +674,10 @@ <example> <title>getlastmod() example</title> <programlisting role="php"> +<![CDATA[ // outputs e.g. 'Last modified: March 04 1998 20:43:59.' echo "Last modified: ".date ("F d Y H:i:s.", getlastmod()); +]]> </programlisting> </example> </para> @@ -820,11 +840,13 @@ <example> <title>Getrusage Example</title> <programlisting role="php"> +<![CDATA[ $dat = getrusage(); echo $dat["ru_nswap"]; # number of swaps echo $dat["ru_majflt"]; # number of page faults echo $dat["ru_utime.tv_sec"]; # user time used (seconds) echo $dat["ru_utime.tv_usec"]; # user time used (microseconds) +]]> </programlisting> </example> See your system's man page on getrusage(2) for more details. @@ -1347,36 +1369,42 @@ use somewhere in your code: <informalexample> <programlisting role="php"> +<![CDATA[ ... phpcredits(CREDITS_GENERAL); ... +]]> </programlisting> </informalexample> And if you want to print the core developers and the documentation group, in a page of its own, you will use: <informalexample> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php phpcredits(CREDITS_GROUP + CREDITS_DOCS + CREDITS_FULLPAGE); -?&gt; +?> +]]> </programlisting> </informalexample> And if you feel like embedding all the credits in your page, then code like the one below will do it: <informalexample> <programlisting role="php"> -&lt;html&gt; - &lt;head&gt; - &lt;title&gt;My credits page&lt;/title&gt; - &lt;/head&gt; - &lt;body&gt; - &lt;?php +<![CDATA[ +<html> + <head> + <title>My credits page</title> + </head> + <body> + <?php // some code of your own phpcredits(CREDITS_ALL); // some more code - ?&gt; - &lt;/body&gt; -&lt;/html&gt; + ?> + </body> +</html> +]]> </programlisting> </informalexample> </para> @@ -1509,8 +1537,10 @@ <example> <title>phpversion() example</title> <programlisting role="php"> +<![CDATA[ // prints e.g. 'Current PHP version: 3.0rel-dev' echo "Current PHP version: ".phpversion(); +]]> </programlisting> </example> </para> @@ -1577,11 +1607,13 @@ <example> <title><function>php_sapi_name</function> Example</title> <programlisting role="php"> +<![CDATA[ $sapi_type = php_sapi_name(); if ($sapi_type == "cgi") print "You are using CGI PHP\n"; else print "You are not using CGI PHP\n"; +]]> </programlisting> </example> </para> @@ -1611,9 +1643,11 @@ <example> <title><function>php_uname</function> Example</title> <programlisting role="php"> +<![CDATA[ if (substr(php_uname(), 0, 7) == "Windows") { die("Sorry, this script doesn't run on Windows.\n"); } +]]> </programlisting> </example> </para> @@ -1665,7 +1699,9 @@ <example> <title>Setting an Environment Variable</title> <programlisting role="php"> +<![CDATA[ putenv ("UNIQID=$uniqid"); +]]> </programlisting> </example> </para> @@ -1790,13 +1826,13 @@ If you specify the third optional <parameter>operator</parameter> argument, you can test for a particular relationship. The possible - operators are: <literal>&lt;</literal>, + operators are: <literal><</literal>, <literal>lt</literal>, <literal>&lt;=</literal>, <literal>le</literal>, <literal>&gt;</literal>, <literal>gt</literal>, <literal>&gt;=</literal>, <literal>ge</literal>, <literal>==</literal>, <literal>=</literal>, <literal>eq</literal>, - <literal>!=</literal>, <literal>&lt;&gt;</literal>, + <literal>!=</literal>, <literal><&gt;</literal>, <literal>ne</literal> respectively. Using this argument, the function will return 1 if the realtionship is the one specified by the @@ -1806,12 +1842,14 @@ <example> <title><function>version_compare</function> example</title> <programlisting role="php"> +<![CDATA[ // prints -1 echo version_compare("4.0.4", "4.0.6"); // these all print 1 -echo version_compare("4.0.4", "4.0.6", "&lt;"); +echo version_compare("4.0.4", "4.0.6", "<"); echo version_compare("4.0.6", "4.0.6", "eq"); +]]> </programlisting> </example> </para> @@ -1860,8 +1898,10 @@ <example> <title><function>zend_version</function> example</title> <programlisting role="php"> +<![CDATA[ // prints e.g. 'Zend engine version: 1.0.4' echo "Zend engine version: ".zend_version(); +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/ingres_ii.xml diff -u phpdoc/en/functions/ingres_ii.xml:1.13 phpdoc/en/functions/ingres_ii.xml:1.14 --- phpdoc/en/functions/ingres_ii.xml:1.13 Sat Nov 10 16:49:37 2001 +++ phpdoc/en/functions/ingres_ii.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <reference id="ref.ingres"> <title>Ingres II functions</title> <titleabbrev>Ingres II</titleabbrev> @@ -93,12 +93,14 @@ <example> <title><function>ingres_connect</function> example</title> <programlisting> -&lt;?php +<![CDATA[ +<?php $link = ingres_connect ("mydb", "user", "pass") or die ("Could not connect"); print ("Connected successfully"); ingres_close ($link); ?> +]]> </programlisting> </example> <example> @@ -106,12 +108,14 @@ <function>ingres_connect</function> example using default link </title> <programlisting> -&lt;?php +<![CDATA[ +<?php ingres_connect ("mydb", "user", "pass") or die ("Could not connect"); print ("Connected successfully"); ingres_close (); ?> +]]> </programlisting> </example> <para> See also @@ -296,7 +300,8 @@ <example> <title><function>ingres_query</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php ingres_connect ($database, $user, $password); ingres_query ("select * from table"); @@ -305,6 +310,7 @@ echo $row[2]; } ?> +]]> </programlisting> </example> </para> @@ -687,10 +693,12 @@ column or make an alias for the column. <informalexample> <programlisting> +<![CDATA[ ingres_query(select t1.f1 as foo t2.f1 as bar from t1, t2); $result = ingres_fetch_array(); $foo = $result["foo"]; $bar = $result["bar"]; +]]> </programlisting> </informalexample> </para> @@ -709,7 +717,8 @@ <example> <title><function>ingres_fetch_array</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php ingres_connect ($database, $user, $password); ingres_query ("select * from table"); @@ -720,6 +729,7 @@ echo $row[2]; } ?> +]]> </programlisting> </example> </para> @@ -767,7 +777,8 @@ <example> <title><function>ingres_fetch_row</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php ingres_connect ($database, $user, $password); ingres_query ("select * from table"); @@ -776,6 +787,7 @@ echo $row[2]; } ?> +]]> </programlisting> </example> </para> @@ -837,7 +849,8 @@ <example> <title><function>ingres_fetch_object</function> example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php ingres_connect ($database, $user, $password); ingres_query ("select * from table"); while ($row = ingres_fetch_object()) { @@ -845,6 +858,7 @@ echo $row->fullname; } ?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/ircg.xml diff -u phpdoc/en/functions/ircg.xml:1.14 phpdoc/en/functions/ircg.xml:1.15 --- phpdoc/en/functions/ircg.xml:1.14 Sat Nov 10 16:49:37 2001 +++ phpdoc/en/functions/ircg.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <reference id="ref.ircg"> <title>IRC Gateway Functions</title> <titleabbrev>IRC Gateway</titleabbrev> @@ -108,11 +108,13 @@ <example> <title><function>ircg_fetch_error_msg</function> example</title> <programlisting role="php"> +<![CDATA[ if (!ircg_join ($id, "#php")) { $error = ircg_fetch_error_msg($id); print ("Can't join channel #php. Errorcode: $error[0] Description: $error[1]"); } +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/java.xml diff -u phpdoc/en/functions/java.xml:1.13 phpdoc/en/functions/java.xml:1.14 --- phpdoc/en/functions/java.xml:1.13 Sat Nov 10 16:49:37 2001 +++ phpdoc/en/functions/java.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <reference id="ref.java"> <title>Java</title> <titleabbrev>PHP / Java Integration</titleabbrev> @@ -20,44 +20,48 @@ <example> <title>Java Example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // get instance of Java class java.lang.System in PHP $system = new Java('java.lang.System'); // demonstrate property access - print 'Java version='.$system-&gt;getProperty('java.version').' &lt;br&gt;'; - print 'Java vendor=' .$system-&gt;getProperty('java.vendor').' &lt;br&gt;'; - print 'OS='.$system-&gt;getProperty('os.name').' '. - $system-&gt;getProperty('os.version').' on '. - $system-&gt;getProperty('os.arch').' &lt;br&gt;'; + print 'Java version='.$system->getProperty('java.version').' <br>'; + print 'Java vendor=' .$system->getProperty('java.vendor').' <br>'; + print 'OS='.$system->getProperty('os.name').' '. + $system->getProperty('os.version').' on '. + $system->getProperty('os.arch').' <br>'; // java.util.Date example $formatter = new Java('java.text.SimpleDateFormat', "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz"); - print $formatter-&gt;format(new Java('java.util.Date')); -?&gt; + print $formatter->format(new Java('java.util.Date')); +?> +]]> </programlisting> </example> <example> <title>AWT Example</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // This example is only intented to be run as a CGI. $frame = new Java('java.awt.Frame', 'PHP'); $button = new Java('java.awt.Button', 'Hello Java World!'); - $frame-&gt;add('North', $button); - $frame-&gt;validate(); - $frame-&gt;pack(); - $frame-&gt;visible = True; + $frame->add('North', $button); + $frame->validate(); + $frame->pack(); + $frame->visible = True; $thread = new Java('java.lang.Thread'); - $thread-&gt;sleep(10000); + $thread->sleep(10000); - $frame-&gt;dispose(); -?&gt; + $frame->dispose(); +?> +]]> </programlisting> </example> @@ -200,9 +204,10 @@ <example> <title>Java exception handler</title> <programlisting role="php"> +<![CDATA[ <?php $stack = new Java('java.util.Stack'); - $stack-&gt;push(1); + $stack->push(1); // This should succeed $result = $stack->pop(); @@ -210,13 +215,14 @@ if (!$ex) print "$result\n"; // This should fail (error suppressed by @) - $result = @$stack-&gt;pop(); + $result = @$stack->pop(); $ex = java_last_exception_get(); if ($ex) print $ex->toString(); // Clear last exception java_last_exception_clear(); ?> +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/ldap.xml diff -u phpdoc/en/functions/ldap.xml:1.35 phpdoc/en/functions/ldap.xml:1.36 --- phpdoc/en/functions/ldap.xml:1.35 Sat Nov 10 16:49:37 2001 +++ phpdoc/en/functions/ldap.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.35 $ --> +<!-- $Revision: 1.36 $ --> <reference id="ref.ldap"> <title>LDAP functions</title> <titleabbrev>LDAP</titleabbrev> @@ -72,48 +72,50 @@ <example> <title>LDAP search example</title> -<programlisting role="php"> -&lt;?php + <programlisting role="php"> +<![CDATA[ +<?php // basic sequence with LDAP is connect, bind, search, interpret search // result, close connection -echo "&lt;h3>LDAP query test&lt;/h3>"; +echo "<h3>LDAP query test</h3>"; echo "Connecting ..."; $ds=ldap_connect("localhost"); // must be a valid LDAP server! -echo "connect result is ".$ds."&lt;p>"; +echo "connect result is ".$ds."<p>"; if ($ds) { echo "Binding ..."; $r=ldap_bind($ds); // this is an "anonymous" bind, typically // read-only access - echo "Bind result is ".$r."&lt;p>"; + echo "Bind result is ".$r."<p>"; echo "Searching for (sn=S*) ..."; // Search surname entry $sr=ldap_search($ds,"o=My Company, c=US", "sn=S*"); - echo "Search result is ".$sr."&lt;p>"; + echo "Search result is ".$sr."<p>"; - echo "Number of entires returned is ".ldap_count_entries($ds,$sr)."&lt;p>"; + echo "Number of entires returned is ".ldap_count_entries($ds,$sr)."<p>"; - echo "Getting entries ...&lt;p>"; + echo "Getting entries ...<p>"; $info = ldap_get_entries($ds, $sr); - echo "Data for ".$info["count"]." items returned:&lt;p>"; + echo "Data for ".$info["count"]." items returned:<p>"; - for ($i=0; $i&lt;$info["count"]; $i++) { - echo "dn is: ". $info[$i]["dn"] ."&lt;br>"; - echo "first cn entry is: ". $info[$i]["cn"][0] ."&lt;br>"; - echo "first email entry is: ". $info[$i]["mail"][0] ."&lt;p>"; + for ($i=0; $i<$info["count"]; $i++) { + echo "dn is: ". $info[$i]["dn"] ."<br>"; + echo "first cn entry is: ". $info[$i]["cn"][0] ."<br>"; + echo "first email entry is: ". $info[$i]["mail"][0] ."<p>"; } echo "Closing connection"; ldap_close($ds); } else { - echo "&lt;h4>Unable to connect to LDAP server&lt;/h4>"; + echo "<h4>Unable to connect to LDAP server</h4>"; } ?> -</programlisting> - </example> +]]> + </programlisting> + </example> <sect2 id="ldap.using"> <title>Using the PHP LDAP calls</title> @@ -237,7 +239,8 @@ <example> <title>Complete example with authenticated bind</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $ds=ldap_connect("localhost"); // assuming the LDAP server is on this host if ($ds) { @@ -258,6 +261,7 @@ echo "Unable to connect to LDAP server"; } ?> +]]> </programlisting> </example> </refsect1> @@ -349,7 +353,8 @@ <example> <title>Complete example of password check</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $ds=ldap_connect("localhost"); // assuming the LDAP server is on this host @@ -383,8 +388,9 @@ } else { echo "Unable to connect to LDAP server."; } -?&gt; +?> +]]> </programlisting> </example> <note> @@ -534,11 +540,13 @@ <example> <title>Enumerating all LDAP error messages</title> <programlisting role="php"> -&lt;?php - for($i=0; $i&lt;100; $i++) { - printf("Error $i: %s&lt;br>\n", ldap_err2str($i)); +<![CDATA[ +<?php + for($i=0; $i<100; $i++) { + printf("Error $i: %s<br>\n", ldap_err2str($i)); } ?> +]]> </programlisting> </example></para> </refsect1> @@ -576,7 +584,8 @@ <example> <title>Generating and catching an error</title> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php // This example contains an error, which we will catch. $ld = ldap_connect("localhost"); $bind = ldap_bind($ld); @@ -584,13 +593,14 @@ // must be "objectclass=*" to work. $res = @ldap_search($ld, "o=Myorg, c=DE", "objectclass"); if (!$res) { - printf("LDAP-Errno: %s&lt;br>\n", ldap_errno($ld)); - printf("LDAP-Error: %s&lt;br>\n", ldap_error($ld)); - die("Argh!&lt;br>\n"); + printf("LDAP-Errno: %s<br>\n", ldap_errno($ld)); + printf("LDAP-Error: %s<br>\n", ldap_error($ld)); + die("Argh!<br>\n"); } $info = ldap_get_entries($ld, $res); -printf("%d matching entries.&lt;br>\n", $info["count"]); +printf("%d matching entries.<br>\n", $info["count"]); ?> +]]> </programlisting> </example></para> <para> @@ -812,6 +822,7 @@ <title>Show the list of attributes held for a particular directory entry </title> <programlisting role="php"> +<![CDATA[ // $ds is the link identifier for the directory // $sr is a valid search result from a prior call to @@ -821,10 +832,11 @@ $attrs = ldap_get_attributes($ds, $entry); -echo $attrs["count"]." attributes held for this entry:&lt;p>"; +echo $attrs["count"]." attributes held for this entry:<p>"; -for ($i=0; $i&lt;$attrs["count"]; $i++) - echo $attrs[$i]."&lt;br>"; +for ($i=0; $i<$attrs["count"]; $i++) + echo $attrs[$i]."<br>"; +]]> </programlisting> </example></para> @@ -944,11 +956,13 @@ <example> <title>Check protocol version</title> <programlisting role="php"> +<![CDATA[ // $ds is a valid link identifier for a directory server if (ldap_get_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version)) echo "Using protocol version $version"; else echo "Unable to determine protocol version"; +]]> </programlisting> </example> </para> @@ -1011,6 +1025,7 @@ <title>List all values of the "mail" attribute for a directory entry </title> <programlisting role="php"> +<![CDATA[ // $ds is a valid link identifier for a directory server // $sr is a valid search result from a prior call to @@ -1021,10 +1036,11 @@ $values = ldap_get_values($ds, $entry,"mail"); -echo $values["count"]." email addresses for this entry.&lt;p>"; +echo $values["count"]." email addresses for this entry.<p>"; -for ($i=0; $i &lt; $values["count"]; $i++) - echo $values[$i]."&lt;br>"; +for ($i=0; $i < $values["count"]; $i++) + echo $values[$i]."<br>"; +]]> </programlisting> </example></para> @@ -1127,6 +1143,7 @@ <title>Produce a list of all organizational units of an organization </title> <programlisting role="php3"> +<![CDATA[ // $ds is a valid link identifier for a directory server $basedn = "o=My Company, c=US"; @@ -1136,8 +1153,9 @@ $info = ldap_get_entries($ds, $sr); -for ($i=0; $i&lt;$info["count"]; $i++) +for ($i=0; $i<$info["count"]; $i++) echo $info[$i]["ou"][0] ; +]]> </programlisting> </example></para> <para> @@ -1539,6 +1557,7 @@ <example> <title>LDAP search</title> <programlisting role="php"> +<![CDATA[ // $ds is a valid link identifier for a directory server // $person is all or part of a person's name, eg "Jo" @@ -1551,7 +1570,8 @@ $info = ldap_get_entries($ds, $sr); -print $info["count"]." entries returned&lt;p>"; +print $info["count"]." entries returned<p>"; +]]> </programlisting> </example></para> <para> @@ -1626,16 +1646,19 @@ <example> <title>Set protocol version</title> <programlisting role="php"> +<![CDATA[ // $ds is a valid link identifier for a directory server if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) echo "Using LDAPv3"; else echo "Failed to set protocol version to 3"; +]]> </programlisting> </example> <example> <title>Set server controls</title> <programlisting role="php"> +<![CDATA[ // $ds is a valid link identifier for a directory server // control with no value $ctrl1 = array("oid" => "1.2.752.58.10.1", "iscritical" => TRUE); @@ -1644,6 +1667,7 @@ // try to set both controls if (!ldap_set_option($ds, LDAP_OPT_SERVER_CONTROLS, array($ctrl1, $ctrl2))) echo "Failed to set server controls"; +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/mail.xml diff -u phpdoc/en/functions/mail.xml:1.32 phpdoc/en/functions/mail.xml:1.33 --- phpdoc/en/functions/mail.xml:1.32 Sat Nov 10 16:49:37 2001 +++ phpdoc/en/functions/mail.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.32 $ --> +<!-- $Revision: 1.33 $ --> <reference id="ref.mail"> <title>Mail functions</title> <titleabbrev>Mail</titleabbrev> @@ -102,7 +102,9 @@ <example> <title>Sending mail.</title> <programlisting> +<![CDATA[ mail("joecool@example.com", "My Subject", "Line 1\nLine 2\nLine 3"); +]]> </programlisting> </example></para> <simpara> @@ -124,10 +126,12 @@ <example> <title>Sending mail with extra headers.</title> <programlisting> +<![CDATA[ mail("nobody@example.com", "the subject", $message, "From: webmaster@$SERVER_NAME\r\n" ."Reply-To: webmaster@$SERVER_NAME\r\n" ."X-Mailer: PHP/" . phpversion()); +]]> </programlisting> </example> </para> @@ -143,8 +147,10 @@ <example> <title>Sending mail with extra headers and setting an additional command line parameter.</title> <programlisting> +<![CDATA[ mail("nobody@example.com", "the subject", $message, "From: webmaster@$SERVER_NAME", "-fwebmaster@$SERVER_NAME"); +]]> </programlisting> </example> </para> @@ -159,32 +165,33 @@ <example> <title>Sending complex email.</title> <programlisting> +<![CDATA[ /* recipients */ -$to = "Mary &lt;mary@example.com&gt;" . ", " ; //note the comma -$to .= "Kelly &lt;kelly@example.com&gt;"; +$to = "Mary <mary@example.com>" . ", " ; //note the comma +$to .= "Kelly <kelly@example.com>"; /* subject */ $subject = "Birthday Reminders for August"; /* message */ $message = ' -&lt;html&gt; -&lt;head&gt; - &lt;title&gt;Birthday Reminders for August&lt;/title&gt; -&lt;/head&gt; -&lt;body&gt; -&lt;p&gt;Here are the birthdays upcoming in August!&lt;/p&gt; -&lt;table&gt; - &lt;tr&gt; - &lt;th&gt;Person&lt;/th&gt;&lt;th&gt;Day&lt;/th&gt;&lt;th&gt;Month&lt;/th&gt;&lt;th&gt;Year&lt;/th&gt; - &lt;/tr&gt; - &lt;tr&gt; - &lt;td&gt;Joe&lt;/td&gt;&lt;td&gt;3rd&lt;/td&gt;&lt;td&gt;August&lt;/td&gt;&lt;td&gt;1970&lt;/td&gt; - &lt;td&gt;Sally&lt;/td&gt;&lt;td&gt;17th&lt;/td&gt;&lt;td&gt;August&lt;/td&gt;&lt;td&gt;1973&lt;/td&gt; - &lt;/tr&gt; -&lt;/table&gt; -&lt;/body&gt; -&lt;/html&gt; +<html> +<head> + <title>Birthday Reminders for August</title> +</head> +<body> +<p>Here are the birthdays upcoming in August!</p> +<table> + <tr> + <th>Person</th><th>Day</th><th>Month</th><th>Year</th> + </tr> + <tr> + <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> + <td>Sally</td><td>17th</td><td>August</td><td>1973</td> + </tr> +</table> +</body> +</html> '; /* To send HTML mail, you can set the Content-type header. */ @@ -192,13 +199,14 @@ $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; /* additional headers */ -$headers .= "From: Birthday Reminder &lt;birthday@example.com&gt;\r\n"; +$headers .= "From: Birthday Reminder <birthday@example.com>\r\n"; $headers .= "Cc: birthdayarchive@example.com\r\n"; $headers .= "Bcc: birthdaycheck@example.com\r\n"; /* and now mail it */ mail($to, $subject, $message, $headers); +]]> </programlisting> </example> </para> @@ -233,10 +241,12 @@ <example> <title>Calculating the hash and subscribing a user</title> <programlisting> +<![CDATA[ $user = "joecool@example.com"; $hash = ezmlm_hash ($user); $query = sprintf ("INSERT INTO sample VALUES (%s, '%s')", $hash, $user); $db->query($query); // using PHPLIB db interface +]]> </programlisting> </example> </para> Index: phpdoc/en/functions/math.xml diff -u phpdoc/en/functions/math.xml:1.58 phpdoc/en/functions/math.xml:1.59 --- phpdoc/en/functions/math.xml:1.58 Thu Nov 15 04:38:47 2001 +++ phpdoc/en/functions/math.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.58 $ --> +<!-- $Revision: 1.59 $ --> <reference id="ref.math"> <title>Mathematical Functions</title> <titleabbrev>Math</titleabbrev> @@ -354,7 +354,9 @@ <example> <title><function>base_convert</function></title> <programlisting role="php"> +<![CDATA[ $binary = base_convert ($hexadecimal, 16, 2); +]]> </programlisting> </example> </para> @@ -661,6 +663,7 @@ <example> <title><function>hexdec</function> example</title> <programlisting role="php"> +<![CDATA[ var_dump(hexdec("See")); var_dump(hexdec("ee")); // both prints "int(238)" @@ -668,6 +671,7 @@ var_dump(hexdec("that")); var_dump(hexdec("a0")); // both prints int(160) +]]> </programlisting> </example> </para> @@ -899,6 +903,7 @@ <parameter>seed</parameter>. <informalexample> <programlisting role="php"> +<![CDATA[ // seed with microseconds function make_seed() { list($usec, $sec) = explode(' ', microtime()); @@ -906,6 +911,7 @@ } mt_srand(make_seed()); $randval = mt_rand(); +]]> </programlisting> </informalexample> </para> @@ -1000,7 +1006,8 @@ thousand separator. This is achieved with this line : </para> <programlisting role="php"> -&lt;?php +<![CDATA[ +<?php $number = 1234.56; @@ -1019,7 +1026,8 @@ $english_format_number = number_format($number, 2, '.', ''); // 1234.56 -?&gt; +?> +]]> </programlisting> </example> </para> @@ -1077,10 +1085,10 @@ <para> <informalexample> <programlisting> - +<![CDATA[ echo pi(); // will echo 3.1415926535898 - +]]> </programlisting> </informalexample> </para> @@ -1249,6 +1257,7 @@ <para> <informalexample> <programlisting role="php"> +<![CDATA[ $foo = round(3.4); // $foo == 3.0 $foo = round(3.5); // $foo == 4.0 $foo = round(3.6); // $foo == 4.0 @@ -1257,6 +1266,7 @@ $foo = round(1.95583, 2); // $foo == 1.96 $foo = round(1241757, -3); // $foo == 1242000 +]]> </programlisting> </informalexample> </para> @@ -1356,6 +1366,7 @@ <parameter>seed</parameter>. <informalexample> <programlisting role="php"> +<![CDATA[ // seed with microseconds function make_seed() { list($usec, $sec) = explode(' ', microtime()); @@ -1363,6 +1374,7 @@ } srand(make_seed()); $randval = rand(); +]]> </programlisting> </informalexample> </para> Index: phpdoc/en/functions/mbstring.xml diff -u phpdoc/en/functions/mbstring.xml:1.15 phpdoc/en/functions/mbstring.xml:1.16 --- phpdoc/en/functions/mbstring.xml:1.15 Sat Nov 10 16:49:37 2001 +++ phpdoc/en/functions/mbstring.xml Sat Nov 17 22:07:18 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.15 $ --> +<!-- $Revision: 1.16 $ --> <reference id="ref.mbstring"> <title>Multi-Byte String Functions</title> <titleabbrev> @@ -67,13 +67,14 @@ PHP and does NOT work with PHP. <informalexample> <programlisting> - +<![CDATA[ Character encodings work with PHP: ISO-8859-*, EUC-JP, UTF-8 Character encodings do NOT work with PHP: JIS, SJIS +]]> </programlisting> </informalexample> </para> @@ -166,9 +167,10 @@ Disable HTTP input conversion in php.ini </title> <programlisting role="php"> - +<![CDATA[ ;; Disable HTTP Input conversion mbstring.http_input = pass +]]> </programlisting> </example> </para> @@ -206,7 +208,7 @@ <example> <title><literal>php.ini</literal> setting example</title> <programlisting role="php"> - +<![CDATA[ ;; Enable output character encoding conversion for all PHP pages ;; Enable Output Buffering @@ -214,6 +216,7 @@ ;; Set mb_output_handler to enable output conversion output_handler = mb_output_handler +]]> </programlisting> </example> </para> @@ -221,8 +224,8 @@ <example> <title>Script example</title> <programlisting role="php"> - -&lt;?php +<![CDATA[ +<?php // Enable output character encoding conversion only for this page @@ -233,7 +236,8 @@ // callback function ob_start('mb_output_handler'); -?&gt; +?> +]]> </programlisting> </example> </para> @@ -360,7 +364,7 @@ <example> <title><literal>php.ini</literal> setting example</title> <programlisting role="php"> - +<![CDATA[ ;; Set default internal encoding ;; Note: Make sure to use character encoding works with PHP mbstring.internal_encoding = UTF-8 ; Set internal encoding to UTF-8 @@ -385,6 +389,7 @@ mbstring.substitute_character = 12307 ; Specify Unicode value mbstring.substitute_character = none ; Do not print character mbstring.substitute_character = long ; Long Example: U+3000,JIS+7E7E +]]> </programlisting> </example> </para> @@ -392,7 +397,7 @@ <example> <title><literal>php.ini</literal> setting for <literal>EUC-JP</literal> users</title> <programlisting role="php"> - +<![CDATA[ ;; Disable Output Buffering output_buffering = Off @@ -410,6 +415,7 @@ ;; Do not print invalid characters mbstring.substitute_character = none +]]> </programlisting> </example> </para> @@ -417,7 +423,7 @@ <example> <title><literal>php.ini</literal> setting for <literal>SJIS</literal> users</title> <programlisting role="php"> - +<![CDATA[ ;; Enable Output Buffering output_buffering = On @@ -438,6 +444,7 @@ ;; Do not print invalid characters mbstring.substitute_character = none +]]> </programlisting> </example> </para> @@ -662,11 +669,13 @@ <example> <title><function>mb_internal_encoding</function> example</title> <programlisting role="php"> +<![CDATA[ /* Set internal character encoding to UTF-8 */ mb_internal_encoding("UTF-8"); /* Display current internal character encoding */ echo mb_internal_encoding(); +]]> </programlisting> </example> </para> @@ -818,12 +827,14 @@ <example> <title>Useless detect order example</title> <programlisting> +<![CDATA[ ; Always detect as ISO-8859-1 detect_order = ISO-8859-1, UTF-8 ; Always detect as UTF-8, since ASCII/UTF-7 values are ; valid for UTF-8 detect_order = UTF-8, ASCII, UTF-7 +]]> </programlisting> </example> </para> @@ -832,6 +843,7 @@ <example> <title><function>mb_detect_order</function> examples</title> <programlisting role="php"> +<![CDATA[ /* Set detection order by enumerated list */ mb_detect_order("eucjp-win,sjis-win,UTF-8"); @@ -843,6 +855,7 @@ /* Display current detection order */ echo implode(", ", mb_detect_order()); +]]> </programlisting> </example> </para> @@ -910,6 +923,7 @@ <example> <title><function>mb_substitute_character</function> example</title> <programlisting role="php"> +<![CDATA[ /* Set with Unicode U+3013 (GETA MARK) */ mb_substitute_character(0x3013); @@ -918,6 +932,7 @@ /* Display current setting */ echo mb_substitute_character(); +]]> </programlisting> </example> </para> @@ -981,8 +996,10 @@ <example> <title><function>mb_output_handler</function> example</title> <programlisting role="php"> +<![CDATA[ mb_http_output("UTF-8"); ob_start("mb_output_handler"); +]]> </programlisting> </example> </para> @@ -1023,10 +1040,12 @@ <example> <title><function>mb_preferred_mime_string</function> example</title> <programlisting role="php"> +<![CDATA[ $outputenc = "sjis-win"; mb_http_output($outputenc); ob_start("mb_output_handler"); header("Content-Type: text/html; charset=" . mb_preferred_mime_name($outputenc)); +]]> </programlisting> </example> </para> @@ -1309,6 +1328,7 @@ <para> <informalexample> <programlisting> +<![CDATA[ Character width U+0000 - U+0019 0 @@ -1316,6 +1336,7 @@ U+2000 - U+FF60 2 U+FF61 - U+FF9F 1 U+FFA0 - 2 +]]> </programlisting> </informalexample> </para> @@ -1375,7 +1396,9 @@ <example> <title><function>mb_strimwidth</function> example</title> <programlisting role="php"> +<![CDATA[ $str = mb_strimwidth($str, 0, 40, "..>"); +]]> </programlisting> </example> </para> @@ -1422,6 +1445,7 @@ <example> <title><function>mb_convert_encoding</function> example</title> <programlisting role="php"> +<![CDATA[ /* Convert internal character encoding to SJIS */ $str = mb_convert_encoding($str, "SJIS"); @@ -1433,7 +1457,7 @@ /* "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS" */ $str = mb_convert_encoding($str, "EUC-JP", "auto"); - +]]> </programlisting> </example> </para> @@ -1478,6 +1502,7 @@ <example> <title><function>mb_detect_encoding</function> example</title> <programlisting role="php"> +<![CDATA[ /* Detect character encoding with current detect_order */ echo mb_detect_encoding($str); @@ -1492,6 +1517,7 @@ $ary[] = "JIS"; $ary[] = "EUC-JP"; echo mb_detect_encoding($str, $ary); +]]> </programlisting> </example> </para> @@ -1538,6 +1564,7 @@ <para> <informalexample> <programlisting> +<![CDATA[ Applicable Conversion Options option : Specify with conversion of following options. Default "KV" @@ -1558,6 +1585,7 @@ "c" : Convert "zen-kaku kata-kana" to "zen-kaku hira-gana" "C" : Convert "zen-kaku hira-gana" to "zen-kaku kata-kana" "V" : Collapse voiced sound notation and convert them into a character. Use with "K","H" +]]> </programlisting> </informalexample> </para> @@ -1565,12 +1593,14 @@ <example> <title><function>mb_convert_kana</function> example</title> <programlisting role="php"> +<![CDATA[ /* Convert all "kana" to "zen-kaku" "kata-kana" */ $str = mb_convert_kana($str, "KVC"); /* Convert "han-kaku" "kata-kana" to "zen-kaku" "kata-kana" and "zen-kaku" alpha-numeric to "han-kaku" */ $str = mb_convert_kana($str, "KVa"); +]]> </programlisting> </example> </para> @@ -1623,11 +1653,13 @@ <example> <title><function>mb_convert_kana</function> example</title> <programlisting role="php"> +<![CDATA[ $name = ""; // kanji $mbox = "kru"; $doma = "gtinn.mon"; -$addr = mb_encode_mimeheader($name, "UTF-7", "Q") . " &lt;" . $mbox . "@" . $doma . ">"; +$addr = mb_encode_mimeheader($name, "UTF-7", "Q") . " <" . $mbox . "@" . $doma . ">"; echo $addr; +]]> </programlisting> </example> </para> @@ -1710,9 +1742,11 @@ <example> <title><function>mb_convert_variables</function> example</title> <programlisting role="php"> +<![CDATA[ /* Convert variables $post1, $post2 to internal encoding */ $interenc = mb_internal_encoding(); $inputenc = mb_convert_variables($interenc, "ASCII,UTF-8,SJIS-win", $post1, $post2); +]]> </programlisting> </example> </para> @@ -1756,6 +1790,7 @@ <example> <title><parameter>convmap</parameter> example</title> <programlisting role="php"> +<![CDATA[ $convmap = array ( int start_code1, int end_code1, int offset1, int mask1, int start_code2, int end_code2, int offset2, int mask2, @@ -1764,6 +1799,7 @@ // Specify Unicode value for start_codeN and end_codeN // Add offsetN to value and take bit-wise 'AND' with maskN, then // it converts value to numeric string reference. +]]> </programlisting> </example> </para> @@ -1773,6 +1809,7 @@ <function>mb_encode_numericentity</function> example </title> <programlisting role="php"> +<![CDATA[ /* Convert Left side of ISO-8859-1 to HTML numeric character reference */ $convmap = array(0x80, 0xff, 0, 0xff); $str = mb_encode_numericentity($str, $convmap, "ISO-8859-1"); @@ -1791,6 +1828,7 @@ 0xe2f0, 0xe32e, 0x1150, 0xffff, 0xe32f, 0xe3ab, 0x1151, 0xffff ); $str = mb_encode_numericentity($str, $convmap, "sjis-win"); +]]> </programlisting> </example> </para> @@ -1837,6 +1875,7 @@ <example> <title><parameter>convmap</parameter> example</title> <programlisting> +<![CDATA[ $convmap = array ( int start_code1, int end_code1, int offset1, int mask1, int start_code2, int end_code2, int offset2, int mask2, @@ -1845,6 +1884,7 @@ // Specify Unicode value for start_codeN and end_codeN // Add offsetN to value and take bit-wise 'AND' with maskN, // then convert value to numeric string reference. +]]> </programlisting> </example> </para>
« previous php.doc (#969338961) next »