cvs: phpdoc /en/reference/array/functions array-change-key-case.xml array-chunk.xml array-count-values.xml array-fill.xml array-filter.xml
array-flip.xml array-intersect.xml array-key-exists.xml array-merge-recursive.xml array-merge.xml array-multisort.xml array-pad.xml array-push.xml
array-reduce.xml array-slice.xml array-splice.xml array-sum.xml array-unshift.xml arsort.xml asort.xml compact.xml count.xml each.xml krsort.xml
rsort.xml shuffle.xml uksort.xml usort.xml

From: Date: Fri, 30 May 2003 18:12:53 +0000
Subject: cvs: phpdoc /en/reference/array/functions array-change-key-case.xml array-chunk.xml array-count-values.xml array-fill.xml array-filter.xml
array-flip.xml array-intersect.xml array-key-exists.xml array-merge-recursive.xml array-merge.xml array-multisort.xml array-pad.xml array-push.xml
array-reduce.xml array-slice.xml array-splice.xml array-sum.xml array-unshift.xml arsort.xml asort.xml compact.xml count.xml each.xml krsort.xml
rsort.xml shuffle.xml uksort.xml usort.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969354102@lists.php.net to get a copy of this message
philip Fri May 30 14:12:53 2003 EDT Modified files: /phpdoc/en/reference/array/functions array-change-key-case.xml array-chunk.xml array-count-values.xml array-fill.xml array-filter.xml array-flip.xml array-intersect.xml array-key-exists.xml array-merge-recursive.xml array-merge.xml array-multisort.xml array-pad.xml array-push.xml array-reduce.xml array-slice.xml array-splice.xml array-sum.xml array-unshift.xml arsort.xml asort.xml compact.xml count.xml each.xml krsort.xml rsort.xml shuffle.xml uksort.xml usort.xml Log: Added php tags (<?php ?>) to examples.

Index: phpdoc/en/reference/array/functions/array-change-key-case.xml diff -u phpdoc/en/reference/array/functions/array-change-key-case.xml:1.7 phpdoc/en/reference/array/functions/array-change-key-case.xml:1.8 --- phpdoc/en/reference/array/functions/array-change-key-case.xml:1.7 Sat May 17 22:32:19 2003 +++ phpdoc/en/reference/array/functions/array-change-key-case.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.113 --> <refentry id="function.array-change-key-case"> <refnamediv> @@ -28,8 +28,10 @@ <title><function>array_change_key_case</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $input_array = array("FirSt" => 1, "SecOnd" => 4); print_r(array_change_key_case($input_array, CASE_UPPER)); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-chunk.xml diff -u phpdoc/en/reference/array/functions/array-chunk.xml:1.6 phpdoc/en/reference/array/functions/array-chunk.xml:1.7 --- phpdoc/en/reference/array/functions/array-chunk.xml:1.6 Fri Nov 1 13:35:26 2002 +++ phpdoc/en/reference/array/functions/array-chunk.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-chunk"> <refnamediv> @@ -33,9 +33,11 @@ <title><function>array_chunk</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $input_array = array('a', 'b', 'c', 'd', 'e'); print_r(array_chunk($input_array, 2)); print_r(array_chunk($input_array, 2, TRUE)); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-count-values.xml diff -u phpdoc/en/reference/array/functions/array-count-values.xml:1.6 phpdoc/en/reference/array/functions/array-count-values.xml:1.7 --- phpdoc/en/reference/array/functions/array-count-values.xml:1.6 Fri Nov 1 13:35:26 2002 +++ phpdoc/en/reference/array/functions/array-count-values.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-count-values"> <refnamediv> @@ -22,8 +22,10 @@ <title><function>array_count_values</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $array = array (1, "hello", 1, "world", "hello"); print_r(array_count_values ($array)); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-fill.xml diff -u phpdoc/en/reference/array/functions/array-fill.xml:1.6 phpdoc/en/reference/array/functions/array-fill.xml:1.7 --- phpdoc/en/reference/array/functions/array-fill.xml:1.6 Sat May 3 17:11:33 2003 +++ phpdoc/en/reference/array/functions/array-fill.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-fill"> <refnamediv> @@ -27,8 +27,10 @@ <title><function>array_fill</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $a = array_fill(5, 6, 'banana'); print_r($a); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-filter.xml diff -u phpdoc/en/reference/array/functions/array-filter.xml:1.9 phpdoc/en/reference/array/functions/array-filter.xml:1.10 --- phpdoc/en/reference/array/functions/array-filter.xml:1.9 Sat May 3 17:54:11 2003 +++ phpdoc/en/reference/array/functions/array-filter.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.62 --> <refentry id="function.array-filter"> <refnamediv> @@ -28,6 +28,7 @@ <title><function>array_filter</function> example</title> <programlisting role="php"> <![CDATA[ +<?php function odd($var) { return ($var % 2 == 1); } @@ -43,6 +44,7 @@ print_r(array_filter($array1, "odd")); echo "Even:\n"; print_r(array_filter($array2, "even")); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-flip.xml diff -u phpdoc/en/reference/array/functions/array-flip.xml:1.7 phpdoc/en/reference/array/functions/array-flip.xml:1.8 --- phpdoc/en/reference/array/functions/array-flip.xml:1.7 Sat May 3 17:54:11 2003 +++ phpdoc/en/reference/array/functions/array-flip.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.107 --> <refentry id="function.array-flip"> <refnamediv> @@ -37,8 +37,10 @@ <title><function>array_flip</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $trans = array_flip ($trans); $original = strtr ($str, $trans); +?> ]]> </programlisting> </example> @@ -48,9 +50,11 @@ <title><function>array_flip</function> example : collision</title> <programlisting role="php"> <![CDATA[ +<?php $trans = array ("a" => 1, "b" => 1, "c" => 2); $trans = array_flip ($trans); print_r($trans); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-intersect.xml diff -u phpdoc/en/reference/array/functions/array-intersect.xml:1.6 phpdoc/en/reference/array/functions/array-intersect.xml:1.7 --- phpdoc/en/reference/array/functions/array-intersect.xml:1.6 Tue Feb 18 13:04:41 2003 +++ phpdoc/en/reference/array/functions/array-intersect.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> <refentry id="function.array-intersect"> <refnamediv> @@ -25,9 +25,11 @@ <title><function>array_intersect</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $array1 = array ("a" => "green", "red", "blue"); $array2 = array ("b" => "green", "yellow", "red"); $result = array_intersect ($array1, $array2); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-key-exists.xml diff -u phpdoc/en/reference/array/functions/array-key-exists.xml:1.5 phpdoc/en/reference/array/functions/array-key-exists.xml:1.6 --- phpdoc/en/reference/array/functions/array-key-exists.xml:1.5 Thu Jun 20 23:35:09 2002 +++ phpdoc/en/reference/array/functions/array-key-exists.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.119 --> <refentry id="function.array-key-exists"> <refnamediv> @@ -24,10 +24,12 @@ <title><function>array_key_exists</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $search_array = array("first" => 1, "second" => 4); if (array_key_exists("first", $search_array)) { echo "The 'first' element is in the array"; } +?> ]]> </programlisting> </example> Index: phpdoc/en/reference/array/functions/array-merge-recursive.xml diff -u phpdoc/en/reference/array/functions/array-merge-recursive.xml:1.4 phpdoc/en/reference/array/functions/array-merge-recursive.xml:1.5 --- phpdoc/en/reference/array/functions/array-merge-recursive.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/array-merge-recursive.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.12 --> <refentry id="function.array-merge-recursive"> <refnamediv> @@ -32,9 +32,11 @@ <title><function>array_merge_recursive</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $ar1 = array ("color" => array ("favorite" => "red"), 5); $ar2 = array (10, "color" => array ("favorite" => "green", "blue")); $result = array_merge_recursive ($ar1, $ar2); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-merge.xml diff -u phpdoc/en/reference/array/functions/array-merge.xml:1.7 phpdoc/en/reference/array/functions/array-merge.xml:1.8 --- phpdoc/en/reference/array/functions/array-merge.xml:1.7 Tue Feb 4 12:19:32 2003 +++ phpdoc/en/reference/array/functions/array-merge.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-merge"> <refnamediv> @@ -31,10 +31,12 @@ <title><function>array_merge</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $array1 = array ("color" => "red", 2, 4); $array2 = array ("a", "b", "color" => "green", "shape" => "trapezoid", 4); $result = array_merge ($array1, $array2); print_r($result); +?> ]]> </programlisting> <para> @@ -61,9 +63,11 @@ <title>Simple <function>array_merge</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $array1 = array(); $array2 = array(1 => "data"); $result = array_merge($array1, $array2); +?> ]]> </programlisting> <para> @@ -82,9 +86,11 @@ them to each other, use the <literal>+</literal> operator: <programlisting role="php"> <![CDATA[ +<?php $array1 = array(); $array2 = array(1 => "data"); $result = $array1 + $array2; +?> ]]> </programlisting> The numeric key will be preserved and thus the association remains. Index: phpdoc/en/reference/array/functions/array-multisort.xml diff -u phpdoc/en/reference/array/functions/array-multisort.xml:1.5 phpdoc/en/reference/array/functions/array-multisort.xml:1.6 --- phpdoc/en/reference/array/functions/array-multisort.xml:1.5 Sat Jan 11 05:08:40 2003 +++ phpdoc/en/reference/array/functions/array-multisort.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.11 --> <refentry id="function.array-multisort"> <refnamediv> @@ -72,9 +72,11 @@ <title>Sorting multiple arrays</title> <programlisting role="php"> <![CDATA[ +<?php $ar1 = array ("10", 100, 100, "a"); $ar2 = array (1, 3, "2", 1); array_multisort ($ar1, $ar2); +?> ]]> </programlisting> </example> @@ -90,9 +92,11 @@ <title>Sorting multi-dimensional array</title> <programlisting role="php"> <![CDATA[ +<?php $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> Index: phpdoc/en/reference/array/functions/array-pad.xml diff -u phpdoc/en/reference/array/functions/array-pad.xml:1.4 phpdoc/en/reference/array/functions/array-pad.xml:1.5 --- phpdoc/en/reference/array/functions/array-pad.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/array-pad.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-pad"> <refnamediv> @@ -32,6 +32,7 @@ <title><function>array_pad</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $input = array (12, 10, 9); $result = array_pad ($input, 5, 0); @@ -42,6 +43,7 @@ $result = array_pad ($input, 2, "noop"); // not padded +?> ]]> </programlisting> </example> Index: phpdoc/en/reference/array/functions/array-push.xml diff -u phpdoc/en/reference/array/functions/array-push.xml:1.5 phpdoc/en/reference/array/functions/array-push.xml:1.6 --- phpdoc/en/reference/array/functions/array-push.xml:1.5 Tue Feb 4 12:19:32 2003 +++ phpdoc/en/reference/array/functions/array-push.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-push"> <refnamediv> @@ -24,7 +24,9 @@ variables pushed. Has the same effect as: <programlisting role="php"> <![CDATA[ +<?php $array[] = $var; +?> ]]> </programlisting> repeated for each <parameter>var</parameter>. @@ -37,9 +39,11 @@ <title><function>array_push</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $stack = array ("orange", "banana"); array_push ($stack, "apple", "raspberry"); print_r($stack); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-reduce.xml diff -u phpdoc/en/reference/array/functions/array-reduce.xml:1.5 phpdoc/en/reference/array/functions/array-reduce.xml:1.6 --- phpdoc/en/reference/array/functions/array-reduce.xml:1.5 Sat Oct 26 16:40:42 2002 +++ phpdoc/en/reference/array/functions/array-reduce.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-reduce"> <refnamediv> @@ -30,6 +30,7 @@ <title><function>array_reduce</function> example</title> <programlisting role="php"> <![CDATA[ +<?php function rsum($v, $w) { $v += $w; return $v; @@ -45,6 +46,7 @@ $b = array_reduce($a, "rsum"); $c = array_reduce($a, "rmul", 10); $d = array_reduce($x, "rsum", 1); +?> ]]> </programlisting> </example> Index: phpdoc/en/reference/array/functions/array-slice.xml diff -u phpdoc/en/reference/array/functions/array-slice.xml:1.4 phpdoc/en/reference/array/functions/array-slice.xml:1.5 --- phpdoc/en/reference/array/functions/array-slice.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/array-slice.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-slice"> <refnamediv> @@ -47,12 +47,14 @@ <title><function>array_slice</function> examples</title> <programlisting role="php"> <![CDATA[ +<?php $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> Index: phpdoc/en/reference/array/functions/array-splice.xml diff -u phpdoc/en/reference/array/functions/array-splice.xml:1.6 phpdoc/en/reference/array/functions/array-splice.xml:1.7 --- phpdoc/en/reference/array/functions/array-splice.xml:1.6 Fri Feb 7 00:07:50 2003 +++ phpdoc/en/reference/array/functions/array-splice.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> <refentry id="function.array-splice"> <refnamediv> @@ -117,6 +117,7 @@ <title><function>array_splice</function> examples</title> <programlisting role="php"> <![CDATA[ +<?php $input = array ("red", "green", "blue", "yellow"); array_splice ($input, 2); // $input is now array ("red", "green") @@ -133,6 +134,7 @@ array_splice ($input, -1, 1, array("black", "maroon")); // $input is now array ("red", "green", // "blue", "black", "maroon") +?> ]]> </programlisting> </example> Index: phpdoc/en/reference/array/functions/array-sum.xml diff -u phpdoc/en/reference/array/functions/array-sum.xml:1.4 phpdoc/en/reference/array/functions/array-sum.xml:1.5 --- phpdoc/en/reference/array/functions/array-sum.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/array-sum.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.59 --> <refentry id="function.array-sum"> <refnamediv> @@ -23,11 +23,13 @@ <title><function>array_sum</function> examples</title> <programlisting role="php"> <![CDATA[ +<?php $a = array(2, 4, 6, 8); echo "sum(a) = ".array_sum($a)."\n"; $b = array("a"=>1.2,"b"=>2.3,"c"=>3.4); echo "sum(b) = ".array_sum($b)."\n"; +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/array-unshift.xml diff -u phpdoc/en/reference/array/functions/array-unshift.xml:1.5 phpdoc/en/reference/array/functions/array-unshift.xml:1.6 --- phpdoc/en/reference/array/functions/array-unshift.xml:1.5 Mon Jun 17 19:48:37 2002 +++ phpdoc/en/reference/array/functions/array-unshift.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.array-unshift"> <refnamediv> @@ -34,8 +34,10 @@ <title><function>array_unshift</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $queue = array ("orange", "banana"); array_unshift ($queue, "apple", "raspberry"); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/arsort.xml diff -u phpdoc/en/reference/array/functions/arsort.xml:1.4 phpdoc/en/reference/array/functions/arsort.xml:1.5 --- phpdoc/en/reference/array/functions/arsort.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/arsort.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.arsort"> <refnamediv> @@ -25,12 +25,14 @@ <title><function>arsort</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $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> <para> Index: phpdoc/en/reference/array/functions/asort.xml diff -u phpdoc/en/reference/array/functions/asort.xml:1.4 phpdoc/en/reference/array/functions/asort.xml:1.5 --- phpdoc/en/reference/array/functions/asort.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/asort.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.asort"> <refnamediv> @@ -23,12 +23,14 @@ <title><function>asort</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $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> <para> Index: phpdoc/en/reference/array/functions/compact.xml diff -u phpdoc/en/reference/array/functions/compact.xml:1.4 phpdoc/en/reference/array/functions/compact.xml:1.5 --- phpdoc/en/reference/array/functions/compact.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/compact.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.compact"> <refnamediv> @@ -38,6 +38,7 @@ <title><function>compact</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $city = "San Francisco"; $state = "CA"; $event = "SIGGRAPH"; @@ -45,6 +46,7 @@ $location_vars = array ("city", "state"); $result = compact ("event", "nothing_here", $location_vars); +?> ]]> </programlisting> <para> Index: phpdoc/en/reference/array/functions/count.xml diff -u phpdoc/en/reference/array/functions/count.xml:1.4 phpdoc/en/reference/array/functions/count.xml:1.5 --- phpdoc/en/reference/array/functions/count.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/count.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.count"> <refnamediv> @@ -41,6 +41,7 @@ <programlisting role="php"> <!-- TODO: examples about count(null), count(false), count(object).. --> <![CDATA[ +<?php $a[0] = 1; $a[1] = 3; $a[2] = 5; @@ -52,6 +53,7 @@ $b[10] = 11; $result = count ($b); // $result == 3; +?> ]]> </programlisting> </example> Index: phpdoc/en/reference/array/functions/each.xml diff -u phpdoc/en/reference/array/functions/each.xml:1.8 phpdoc/en/reference/array/functions/each.xml:1.9 --- phpdoc/en/reference/array/functions/each.xml:1.8 Tue Feb 4 12:19:32 2003 +++ phpdoc/en/reference/array/functions/each.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.each"> <refnamediv> @@ -36,9 +36,11 @@ <title><function>each</function> examples</title> <programlisting role="php"> <![CDATA[ +<?php $foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese"); $bar = each ($foo); print_r($bar); +?> ]]> </programlisting> <para> @@ -57,9 +59,11 @@ </screen> <programlisting role="php"> <![CDATA[ +<?php $foo = array ("Robert" => "Bob", "Seppo" => "Sepi"); $bar = each ($foo); print_r($bar); +?> ]]> </programlisting> </para> @@ -91,11 +95,13 @@ </title> <programlisting role="php"> <![CDATA[ +<?php echo "Values submitted via POST method:<br />\n"; reset ($_POST); while (list ($key, $val) = each ($_POST)) { echo "$key => $val<br />\n"; } +?> ]]> </programlisting> </example> Index: phpdoc/en/reference/array/functions/krsort.xml diff -u phpdoc/en/reference/array/functions/krsort.xml:1.4 phpdoc/en/reference/array/functions/krsort.xml:1.5 --- phpdoc/en/reference/array/functions/krsort.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/krsort.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.krsort"> <refnamediv> @@ -20,12 +20,14 @@ <title><function>krsort</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $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> Index: phpdoc/en/reference/array/functions/rsort.xml diff -u phpdoc/en/reference/array/functions/rsort.xml:1.4 phpdoc/en/reference/array/functions/rsort.xml:1.5 --- phpdoc/en/reference/array/functions/rsort.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/rsort.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.rsort"> <refnamediv> @@ -19,12 +19,14 @@ <title><function>rsort</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $fruits = array ("lemon", "orange", "banana", "apple"); rsort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } +?> ]]> </programlisting> </example> Index: phpdoc/en/reference/array/functions/shuffle.xml diff -u phpdoc/en/reference/array/functions/shuffle.xml:1.4 phpdoc/en/reference/array/functions/shuffle.xml:1.5 --- phpdoc/en/reference/array/functions/shuffle.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/shuffle.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.shuffle"> <refnamediv> @@ -20,12 +20,14 @@ <title><function>shuffle</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $numbers = range (1,20); srand ((float)microtime()*1000000); shuffle ($numbers); while (list (, $number) = each ($numbers)) { echo "$number "; } +?> ]]> </programlisting> </example> Index: phpdoc/en/reference/array/functions/uksort.xml diff -u phpdoc/en/reference/array/functions/uksort.xml:1.5 phpdoc/en/reference/array/functions/uksort.xml:1.6 --- phpdoc/en/reference/array/functions/uksort.xml:1.5 Sat Oct 26 16:40:42 2002 +++ phpdoc/en/reference/array/functions/uksort.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.uksort"> <refnamediv> @@ -25,6 +25,7 @@ <title><function>uksort</function> example</title> <programlisting role="php"> <![CDATA[ +<?php function cmp ($a, $b) { if ($a == $b) return 0; return ($a > $b) ? -1 : 1; @@ -37,6 +38,7 @@ while (list ($key, $value) = each ($a)) { echo "$key: $value\n"; } +?> ]]> </programlisting> </example> Index: phpdoc/en/reference/array/functions/usort.xml diff -u phpdoc/en/reference/array/functions/usort.xml:1.9 phpdoc/en/reference/array/functions/usort.xml:1.10 --- phpdoc/en/reference/array/functions/usort.xml:1.9 Tue May 6 16:30:27 2003 +++ phpdoc/en/reference/array/functions/usort.xml Fri May 30 14:12:53 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.usort"> <refnamediv> @@ -40,6 +40,7 @@ <title><function>usort</function> example</title> <programlisting role="php"> <![CDATA[ +<?php function cmp ($a, $b) { if ($a == $b) return 0; return ($a < $b) ? -1 : 1; @@ -52,6 +53,7 @@ while (list ($key, $value) = each ($a)) { echo "$key: $value\n"; } +?> ]]> </programlisting> </example> @@ -83,6 +85,7 @@ </title> <programlisting role="php"> <![CDATA[ +<?php function cmp ($a, $b) { return strcmp($a["fruit"], $b["fruit"]); } @@ -96,6 +99,7 @@ while (list ($key, $value) = each ($fruits)) { echo "\$fruits[$key]: " . $value["fruit"] . "\n"; } +?> ]]> </programlisting> </example> @@ -124,6 +128,7 @@ </title> <programlisting role="php"> <![CDATA[ +<?php class TestObj { var $name; @@ -151,6 +156,7 @@ foreach ($a as $item) { print $item->name."\n"; } +?> ]]> </programlisting> </example>
« previous php.doc (#969354102) next »