cvs: phpdoc /en/reference/array/functions array-change-key-case.xml array-chunk.xml array-combine.xml array-count-values.xml array-diff-assoc.xml
array-diff-key.xml array-diff-uassoc.xml array-diff-ukey.xml array-diff.xml array-fill.xml array-filter.xml array-flip.xml array-intersect-assoc.xml
array-intersect-key.xml array-intersect-uassoc.xml array-intersect-ukey.xml array-intersect.xml array-key-exists.xml array-keys.xml array-map.xml
array-merge-recursive.xml array-merge.xml array-multisort.xml array-pad.xml array-pop.xml array-product.xml array-push.xml array-rand.xml
array-reduce.xml array-reverse.xml array-search.xml array-shift.xml array-slice.xml array-splice.xml array-sum.xml array-udiff-assoc.xml
array-udiff-uassoc.xml array-udiff.xml array-uintersect-assoc.xml array-uintersect-uassoc.xml array-uintersect.xml array-unique.xml array-unshift.xml
array-values.xml array-walk-recursive.xml array-walk.xml array.xml arsort.xml asort.xml compact.xml count.xml curr! ent.xml each.xml end.xml
extract.xml in-array.xml key.xml krsort.xml ksort.xml list.xml natcasesort.xml natsort.xml next.xml prev.xml range.xml reset.xml rsort.xml shuffle.xml
sort.xml uasort.xml uksort.xml usort.xml

From: Date: Tue, 31 Oct 2006 11:24:02 +0000
Subject: cvs: phpdoc /en/reference/array/functions array-change-key-case.xml array-chunk.xml array-combine.xml array-count-values.xml array-diff-assoc.xml
array-diff-key.xml array-diff-uassoc.xml array-diff-ukey.xml array-diff.xml array-fill.xml array-filter.xml array-flip.xml array-intersect-assoc.xml
array-intersect-key.xml array-intersect-uassoc.xml array-intersect-ukey.xml array-intersect.xml array-key-exists.xml array-keys.xml array-map.xml
array-merge-recursive.xml array-merge.xml array-multisort.xml array-pad.xml array-pop.xml array-product.xml array-push.xml array-rand.xml
array-reduce.xml array-reverse.xml array-search.xml array-shift.xml array-slice.xml array-splice.xml array-sum.xml array-udiff-assoc.xml
array-udiff-uassoc.xml array-udiff.xml array-uintersect-assoc.xml array-uintersect-uassoc.xml array-uintersect.xml array-unique.xml array-unshift.xml
array-values.xml array-walk-recursive.xml array-walk.xml array.xml arsort.xml asort.xml compact.xml count.xml curr! ent.xml each.xml end.xml
extract.xml in-array.xml key.xml krsort.xml ksort.xml list.xml natcasesort.xml natsort.xml next.xml prev.xml range.xml reset.xml rsort.xml shuffle.xml
sort.xml uasort.xml uksort.xml usort.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969374301@lists.php.net to get a copy of this message
bjori Tue Oct 31 11:24:02 2006 UTC Modified files: /phpdoc/en/reference/array/functions array-change-key-case.xml array-chunk.xml array-combine.xml array-count-values.xml array-diff-assoc.xml array-diff-key.xml array-diff-uassoc.xml array-diff-ukey.xml array-diff.xml array-fill.xml array-filter.xml array-flip.xml array-intersect-assoc.xml array-intersect-key.xml array-intersect-uassoc.xml array-intersect-ukey.xml array-intersect.xml array-key-exists.xml array-keys.xml array-map.xml array-merge-recursive.xml array-merge.xml array-multisort.xml array-pad.xml array-pop.xml array-product.xml array-push.xml array-rand.xml array-reduce.xml array-reverse.xml array-search.xml array-shift.xml array-slice.xml array-splice.xml array-sum.xml array-udiff-assoc.xml array-udiff-uassoc.xml array-udiff.xml array-uintersect-assoc.xml array-uintersect-uassoc.xml array-uintersect.xml array-unique.xml array-unshift.xml array-values.xml array-walk-recursive.xml array-walk.xml array.xml arsort.xml asort.xml compact.xml count.xml current.xml each.xml end.xml extract.xml in-array.xml key.xml krsort.xml ksort.xml list.xml natcasesort.xml natsort.xml next.xml prev.xml range.xml reset.xml rsort.xml shuffle.xml sort.xml uasort.xml uksort.xml usort.xml Log: WS, preparation for the new doc style...

http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-change-key-case.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-change-key-case.xml diff -u phpdoc/en/reference/array/functions/array-change-key-case.xml:1.11 phpdoc/en/reference/array/functions/array-change-key-case.xml:1.12 --- phpdoc/en/reference/array/functions/array-change-key-case.xml:1.11 Mon Nov 1 12:39:22 2004 +++ phpdoc/en/reference/array/functions/array-change-key-case.xml Tue Oct 31 11:24:01 2006 @@ -1,41 +1,41 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.113 --> - <refentry id="function.array-change-key-case"> - <refnamediv> - <refname>array_change_key_case</refname> - <refpurpose>Returns an array with all string keys lowercased or uppercased</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_change_key_case</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>case</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_change_key_case</function> changes the - keys in the <parameter>input</parameter> array to - be all lowercase or uppercase. The change depends - on the last optional <parameter>case</parameter> - parameter. You can pass two constants there, - <constant>CASE_UPPER</constant> and - <constant>CASE_LOWER</constant>. The default is - <constant>CASE_LOWER</constant>. The function will leave - number indices as is. - </para> - <example> - <title><function>array_change_key_case</function> example</title> - <programlisting role="php"> +<refentry id="function.array-change-key-case"> + <refnamediv> + <refname>array_change_key_case</refname> + <refpurpose>Returns an array with all string keys lowercased or uppercased</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_change_key_case</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>case</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_change_key_case</function> changes the + keys in the <parameter>input</parameter> array to + be all lowercase or uppercase. The change depends + on the last optional <parameter>case</parameter> + parameter. You can pass two constants there, + <constant>CASE_UPPER</constant> and + <constant>CASE_LOWER</constant>. The default is + <constant>CASE_LOWER</constant>. The function will leave + number indices as is. + </para> + <example> + <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> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -43,15 +43,15 @@ [SECOND] => 4 ) ]]> - </screen> - </example> - <para> - If an array has indices that will be the same once run through this - function (e.g. "keY" and "kEY"), the value that is later in the array - will override other indices. - </para> - </refsect1> - </refentry> + </screen> + </example> + <para> + If an array has indices that will be the same once run through this + function (e.g. "keY" and "kEY"), the value that is later in the array + will override other indices. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-chunk.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/array/functions/array-chunk.xml diff -u phpdoc/en/reference/array/functions/array-chunk.xml:1.10 phpdoc/en/reference/array/functions/array-chunk.xml:1.11 --- phpdoc/en/reference/array/functions/array-chunk.xml:1.10 Mon Nov 1 12:39:22 2004 +++ phpdoc/en/reference/array/functions/array-chunk.xml Tue Oct 31 11:24:01 2006 @@ -1,37 +1,37 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-chunk"> - <refnamediv> - <refname>array_chunk</refname> - <refpurpose>Split an array into chunks</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_chunk</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam><type>int</type><parameter>size</parameter></methodparam> - <methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_chunk</function> splits the array into - several arrays with <parameter>size</parameter> values - in them. You may also have an array with less values - at the end. You get the arrays as members of a - multidimensional array indexed with numbers starting - from zero. - </para> - <para> - By setting the optional <parameter>preserve_keys</parameter> - parameter to &true;, you can force PHP to preserve the original - keys from the input array. If you specify &false; new number - indices will be used in each resulting array with - indices starting from zero. The default is &false;. - </para> - <example> - <title><function>array_chunk</function> example</title> - <programlisting role="php"> +<refentry id="function.array-chunk"> + <refnamediv> + <refname>array_chunk</refname> + <refpurpose>Split an array into chunks</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_chunk</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam><type>int</type><parameter>size</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_chunk</function> splits the array into + several arrays with <parameter>size</parameter> values + in them. You may also have an array with less values + at the end. You get the arrays as members of a + multidimensional array indexed with numbers starting + from zero. + </para> + <para> + By setting the optional <parameter>preserve_keys</parameter> + parameter to &true;, you can force PHP to preserve the original + keys from the input array. If you specify &false; new number + indices will be used in each resulting array with + indices starting from zero. The default is &false;. + </para> + <example> + <title><function>array_chunk</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $input_array = array('a', 'b', 'c', 'd', 'e'); @@ -39,9 +39,9 @@ print_r(array_chunk($input_array, 2, true)); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -84,10 +84,10 @@ ) ]]> - </screen> - </example> - </refsect1> - </refentry> + </screen> + </example> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-combine.xml?r1=1.6&r2=1.7&diff_format=u Index: phpdoc/en/reference/array/functions/array-combine.xml diff -u phpdoc/en/reference/array/functions/array-combine.xml:1.6 phpdoc/en/reference/array/functions/array-combine.xml:1.7 --- phpdoc/en/reference/array/functions/array-combine.xml:1.6 Mon Nov 1 12:39:22 2004 +++ phpdoc/en/reference/array/functions/array-combine.xml Tue Oct 31 11:24:01 2006 @@ -1,32 +1,30 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> - <refentry id="function.array-combine"> - <refnamediv> - <refname>array_combine</refname> - <refpurpose> - Creates an array by using one array for keys and another for its values - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_combine</methodname> - <methodparam><type>array</type><parameter>keys</parameter></methodparam> - <methodparam><type>array</type><parameter>values</parameter></methodparam> - </methodsynopsis> - <para> - Returns an <type>array</type> by using the values from the - <parameter>keys</parameter> array as keys and the values from the - <parameter>values</parameter> array as the corresponding values. - </para> - <para> - Returns &false; if the number of elements for each array isn't equal or - if the arrays are empty. - </para> - <para> - <example> - <title>A simple <function>array_combine</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.7 $ --> +<refentry id="function.array-combine"> + <refnamediv> + <refname>array_combine</refname> + <refpurpose>Creates an array by using one array for keys and another for its values</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_combine</methodname> + <methodparam><type>array</type><parameter>keys</parameter></methodparam> + <methodparam><type>array</type><parameter>values</parameter></methodparam> + </methodsynopsis> + <para> + Returns an <type>array</type> by using the values from the + <parameter>keys</parameter> array as keys and the values from the + <parameter>values</parameter> array as the corresponding values. + </para> + <para> + Returns &false; if the number of elements for each array isn't equal or + if the arrays are empty. + </para> + <para> + <example> + <title>A simple <function>array_combine</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $a = array('green', 'red', 'yellow'); @@ -36,9 +34,9 @@ print_r($c); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -47,16 +45,16 @@ [yellow] => banana ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_merge</function>, - <function>array_walk</function>, and - <function>array_values</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_merge</function>, + <function>array_walk</function>, and + <function>array_values</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-count-values.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-count-values.xml diff -u phpdoc/en/reference/array/functions/array-count-values.xml:1.11 phpdoc/en/reference/array/functions/array-count-values.xml:1.12 --- phpdoc/en/reference/array/functions/array-count-values.xml:1.11 Mon Nov 1 12:39:22 2004 +++ phpdoc/en/reference/array/functions/array-count-values.xml Tue Oct 31 11:24:01 2006 @@ -1,35 +1,35 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-count-values"> - <refnamediv> - <refname>array_count_values</refname> - <refpurpose>Counts all the values of an array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_count_values</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_count_values</function> returns an array using - the values of the <parameter>input</parameter> array as keys and - their frequency in <parameter>input</parameter> as values. - </para> - <para> - <example> - <title><function>array_count_values</function> example</title> - <programlisting role="php"> +<refentry id="function.array-count-values"> + <refnamediv> + <refname>array_count_values</refname> + <refpurpose>Counts all the values of an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_count_values</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_count_values</function> returns an array using + the values of the <parameter>input</parameter> array as keys and + their frequency in <parameter>input</parameter> as values. + </para> + <para> + <example> + <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> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -38,17 +38,17 @@ [world] => 1 ) ]]> - </screen> - </example> - </para> - <para> - See also <function>count</function>, - <function>array_unique</function>, - <function>array_values</function>, and - <function>count_chars</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>count</function>, + <function>array_unique</function>, + <function>array_values</function>, and + <function>count_chars</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-diff-assoc.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc/en/reference/array/functions/array-diff-assoc.xml diff -u phpdoc/en/reference/array/functions/array-diff-assoc.xml:1.5 phpdoc/en/reference/array/functions/array-diff-assoc.xml:1.6 --- phpdoc/en/reference/array/functions/array-diff-assoc.xml:1.5 Mon Nov 1 12:39:22 2004 +++ phpdoc/en/reference/array/functions/array-diff-assoc.xml Tue Oct 31 11:24:01 2006 @@ -1,30 +1,30 @@ <?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.14 --> - <refentry id="function.array-diff-assoc"> - <refnamediv> - <refname>array_diff_assoc</refname> - <refpurpose>Computes the difference of arrays with additional index check</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_diff_assoc</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_diff_assoc</function> returns an <type>array</type> - containing all the values from <parameter>array1</parameter> - that are not present in any of the other arguments. - Note that the keys are used in the comparison unlike - <function>array_diff</function>. - </para> - <para> - <example> - <title><function>array_diff_assoc</function> example</title> - <programlisting role="php"> +<refentry id="function.array-diff-assoc"> + <refnamediv> + <refname>array_diff_assoc</refname> + <refpurpose>Computes the difference of arrays with additional index check</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_diff_assoc</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_diff_assoc</function> returns an <type>array</type> + containing all the values from <parameter>array1</parameter> + that are not present in any of the other arguments. + Note that the keys are used in the comparison unlike + <function>array_diff</function>. + </para> + <para> + <example> + <title><function>array_diff_assoc</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); @@ -33,9 +33,9 @@ print_r($result); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -44,37 +44,37 @@ [0] => red ) ]]> - </screen> - </example> - </para> - <simpara> - In our example above you see the <literal>"a" =&gt; "green"</literal> - pair is present in both arrays and thus it is not in the ouput from the - function. Unlike this, the pair <literal>0 =&gt; "red"</literal> - is in the ouput because in the second argument <literal>"red"</literal> - has key which is <literal>1</literal>. - </simpara> - <simpara> - Two values from <emphasis>key =&gt; value</emphasis> pairs are - considered equal only if <literal>(string) $elem1 === (string) - $elem2 </literal>. In other words a strict check takes place so - the string representations must be the same. - <!-- TODO: example of it... --> - </simpara> - <note> - <simpara> - Please note that this function only checks one dimension of a n-dimensional - array. Of course you can check deeper dimensions by using, for example, - <literal>array_diff_assoc($array1[0], $array2[0]);</literal>. - </simpara> - </note> - <para> - See also <function>array_diff</function>, - <function>array_intersect</function>, - and <function>array_intersect_assoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <simpara> + In our example above you see the <literal>"a" =&gt; "green"</literal> + pair is present in both arrays and thus it is not in the ouput from the + function. Unlike this, the pair <literal>0 =&gt; "red"</literal> + is in the ouput because in the second argument <literal>"red"</literal> + has key which is <literal>1</literal>. + </simpara> + <simpara> + Two values from <emphasis>key =&gt; value</emphasis> pairs are + considered equal only if <literal>(string) $elem1 === (string) + $elem2 </literal>. In other words a strict check takes place so + the string representations must be the same. + <!-- TODO: example of it... --> + </simpara> + <note> + <simpara> + Please note that this function only checks one dimension of a n-dimensional + array. Of course you can check deeper dimensions by using, for example, + <literal>array_diff_assoc($array1[0], $array2[0]);</literal>. + </simpara> + </note> + <para> + See also <function>array_diff</function>, + <function>array_intersect</function>, + and <function>array_intersect_assoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-diff-key.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/array/functions/array-diff-key.xml diff -u phpdoc/en/reference/array/functions/array-diff-key.xml:1.2 phpdoc/en/reference/array/functions/array-diff-key.xml:1.3 --- phpdoc/en/reference/array/functions/array-diff-key.xml:1.2 Mon Nov 1 12:39:22 2004 +++ phpdoc/en/reference/array/functions/array-diff-key.xml Tue Oct 31 11:24:01 2006 @@ -1,30 +1,30 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> - <refentry id="function.array-diff-key"> - <refnamediv> - <refname>array_diff_key</refname> - <refpurpose>Computes the difference of arrays using keys for comparison</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_diff_key</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_diff_key</function> returns an array - containing all the values of <parameter>array1</parameter> - that have keys that are not present in any of the other arguments. - Note that the associativity is preserved. This function is like - <function>array_diff</function> except the comparison is done on the - keys instead of the values. - </para> - <para> - <example> - <title><function>array_diff_key</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.3 $ --> +<refentry id="function.array-diff-key"> + <refnamediv> + <refname>array_diff_key</refname> + <refpurpose>Computes the difference of arrays using keys for comparison</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_diff_key</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_diff_key</function> returns an array + containing all the values of <parameter>array1</parameter> + that have keys that are not present in any of the other arguments. + Note that the associativity is preserved. This function is like + <function>array_diff</function> except the comparison is done on the + keys instead of the values. + </para> + <para> + <example> + <title><function>array_diff_key</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); @@ -33,9 +33,9 @@ var_dump(array_diff_key($array1, $array2)); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ array(2) { ["red"]=> @@ -44,39 +44,39 @@ int(4) } ]]> - </screen> - </example> - </para> - <simpara> - The two keys from the <literal>key =&gt; value</literal> pairs are - considered equal only if - <literal>(string) $key1 === (string) $key2 </literal>. In other words - a strict type check is executed so the string representation must be - the same. - </simpara> - <note> - <simpara> - Please note that this function only checks one dimension of a n-dimensional - array. Of course you can check deeper dimensions by using - <literal>array_diff_key($array1[0], $array2[0]);</literal>. - </simpara> - </note> - <para> - See also <function>array_diff</function>, - <function>array_udiff</function> - <function>array_diff_assoc</function>, - <function>array_diff_uassoc</function>, - <function>array_udiff_assoc</function>, - <function>array_udiff_uassoc</function>, - <function>array_diff_ukey</function>, - <function>array_intersect</function>, - <function>array_intersect_assoc</function>, - <function>array_intersect_uassoc</function>, - <function>array_intersect_key</function> and - <function>array_intersect_ukey</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <simpara> + The two keys from the <literal>key =&gt; value</literal> pairs are + considered equal only if + <literal>(string) $key1 === (string) $key2 </literal>. In other words + a strict type check is executed so the string representation must be + the same. + </simpara> + <note> + <simpara> + Please note that this function only checks one dimension of a n-dimensional + array. Of course you can check deeper dimensions by using + <literal>array_diff_key($array1[0], $array2[0]);</literal>. + </simpara> + </note> + <para> + See also <function>array_diff</function>, + <function>array_udiff</function> + <function>array_diff_assoc</function>, + <function>array_diff_uassoc</function>, + <function>array_udiff_assoc</function>, + <function>array_udiff_uassoc</function>, + <function>array_diff_ukey</function>, + <function>array_intersect</function>, + <function>array_intersect_assoc</function>, + <function>array_intersect_uassoc</function>, + <function>array_intersect_key</function> and + <function>array_intersect_ukey</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-diff-uassoc.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc/en/reference/array/functions/array-diff-uassoc.xml diff -u phpdoc/en/reference/array/functions/array-diff-uassoc.xml:1.7 phpdoc/en/reference/array/functions/array-diff-uassoc.xml:1.8 --- phpdoc/en/reference/array/functions/array-diff-uassoc.xml:1.7 Mon Mar 7 11:39:04 2005 +++ phpdoc/en/reference/array/functions/array-diff-uassoc.xml Tue Oct 31 11:24:01 2006 @@ -1,45 +1,42 @@ <?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.14 --> - <refentry id="function.array-diff-uassoc"> - <refnamediv> - <refname>array_diff_uassoc</refname> - <refpurpose> - Computes the difference of arrays with additional index check - which is performed by a user supplied callback function - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_diff_uassoc</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> - <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_diff_uassoc</function> returns an <type>array</type> - containing all the values from <parameter>array1</parameter> - that are not present in any of the other arguments. - Note that the keys are used in the comparison unlike - <function>array_diff</function>. - </para> - <para> - This comparison is done by a user supplied callback function. - It must return an integer less than, equal - to, or greater than zero if the first argument is considered to - be respectively less than, equal to, or greater than the - second. This is unlike <function>array_diff_assoc</function> where an - internal function for comparing the indices is used. - </para> - <para> - <example> - <title><function>array_diff_uassoc</function> example</title> - <programlisting role="php"> +<refentry id="function.array-diff-uassoc"> + <refnamediv> + <refname>array_diff_uassoc</refname> + <refpurpose>Computes the difference of arrays with additional index check which is performed by a user supplied callback function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_diff_uassoc</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> + <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_diff_uassoc</function> returns an <type>array</type> + containing all the values from <parameter>array1</parameter> + that are not present in any of the other arguments. + Note that the keys are used in the comparison unlike + <function>array_diff</function>. + </para> + <para> + This comparison is done by a user supplied callback function. + It must return an integer less than, equal + to, or greater than zero if the first argument is considered to + be respectively less than, equal to, or greater than the + second. This is unlike <function>array_diff_assoc</function> where an + internal function for comparing the indices is used. + </para> + <para> + <example> + <title><function>array_diff_uassoc</function> example</title> + <programlisting role="php"> <![CDATA[ <?php -function key_compare_func($a, $b) +function key_compare_func($a, $b) { if ($a === $b) { return 0; @@ -53,9 +50,9 @@ print_r($result); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -64,41 +61,41 @@ [0] => red ) ]]> - </screen> - </example> - </para> - <simpara> - In our example above you see the <literal>"a" =&gt; "green"</literal> - pair is present in both arrays and thus it is not in the ouput from the - function. Unlike this, the pair <literal>0 =&gt; "red"</literal> - is in the ouput because in the second argument <literal>"red"</literal> - has key which is <literal>1</literal>. - </simpara> - <simpara> - The equality of 2 indices is checked by the user supplied callback function. - </simpara> - <note> - <simpara> - Please note that this function only checks one dimension of a n-dimensional - array. Of course you can check deeper dimensions by using, for example, - <literal>array_diff_uassoc($array1[0], $array2[0], "key_compare_func");</literal>. - </simpara> - </note> - <para> - See also - <function>array_diff</function>, - <function>array_diff_assoc</function>, - <function>array_udiff</function>, - <function>array_udiff_assoc</function>, - <function>array_udiff_uassoc</function>, - <function>array_intersect</function>, - <function>array_intersect_assoc</function>, - <function>array_uintersect</function>, - <function>array_uintersect_assoc</function> and - <function>array_uintersect_uassoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <simpara> + In our example above you see the <literal>"a" =&gt; "green"</literal> + pair is present in both arrays and thus it is not in the ouput from the + function. Unlike this, the pair <literal>0 =&gt; "red"</literal> + is in the ouput because in the second argument <literal>"red"</literal> + has key which is <literal>1</literal>. + </simpara> + <simpara> + The equality of 2 indices is checked by the user supplied callback function. + </simpara> + <note> + <simpara> + Please note that this function only checks one dimension of a n-dimensional + array. Of course you can check deeper dimensions by using, for example, + <literal>array_diff_uassoc($array1[0], $array2[0], "key_compare_func");</literal>. + </simpara> + </note> + <para> + See also + <function>array_diff</function>, + <function>array_diff_assoc</function>, + <function>array_udiff</function>, + <function>array_udiff_assoc</function>, + <function>array_udiff_uassoc</function>, + <function>array_intersect</function>, + <function>array_intersect_assoc</function>, + <function>array_uintersect</function>, + <function>array_uintersect_assoc</function> and + <function>array_uintersect_uassoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-diff-ukey.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/array/functions/array-diff-ukey.xml diff -u phpdoc/en/reference/array/functions/array-diff-ukey.xml:1.3 phpdoc/en/reference/array/functions/array-diff-ukey.xml:1.4 --- phpdoc/en/reference/array/functions/array-diff-ukey.xml:1.3 Thu Feb 24 10:52:11 2005 +++ phpdoc/en/reference/array/functions/array-diff-ukey.xml Tue Oct 31 11:24:01 2006 @@ -1,37 +1,37 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> - <refentry id="function.array-diff-ukey"> - <refnamediv> - <refname>array_diff_ukey</refname> - <refpurpose>Computes the difference of arrays using a callback function on the keys for comparison</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_diff_ukey</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_diff_ukey</function> returns an array - containing all the values of <parameter>array1</parameter> - that have keys that are not present in any of the other arguments. - Note that the associativity is preserved. This function is like - <function>array_diff</function> except the comparison is done on the - keys instead of the values. - </para> - <para> - This comparison is done by a user supplied callback function. - It must return an integer less than, equal to, or greater than zero if the - first key is considered to be respectively less than, equal to, or - greater than the second. - </para> - <para> - <example> - <title><function>array_diff_ukey</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.4 $ --> +<refentry id="function.array-diff-ukey"> + <refnamediv> + <refname>array_diff_ukey</refname> + <refpurpose>Computes the difference of arrays using a callback function on the keys for comparison</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_diff_ukey</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_diff_ukey</function> returns an array + containing all the values of <parameter>array1</parameter> + that have keys that are not present in any of the other arguments. + Note that the associativity is preserved. This function is like + <function>array_diff</function> except the comparison is done on the + keys instead of the values. + </para> + <para> + This comparison is done by a user supplied callback function. + It must return an integer less than, equal to, or greater than zero if the + first key is considered to be respectively less than, equal to, or + greater than the second. + </para> + <para> + <example> + <title><function>array_diff_ukey</function> example</title> + <programlisting role="php"> <![CDATA[ <?php function key_compare_func($key1, $key2) @@ -50,9 +50,9 @@ var_dump(array_diff_ukey($array1, $array2, 'key_compare_func')); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ array(2) { ["red"]=> @@ -61,32 +61,32 @@ int(4) } ]]> - </screen> - </example> - </para> - <note> - <simpara> - Please note that this function only checks one dimension of a n-dimensional - array. Of course you can check deeper dimensions by using - <literal>array_diff_ukey($array1[0], $array2[0], 'callback_func');</literal>. - </simpara> - </note> - <para> - See also <function>array_diff</function>, - <function>array_udiff</function> - <function>array_diff_assoc</function>, - <function>array_diff_uassoc</function>, - <function>array_udiff_assoc</function>, - <function>array_udiff_uassoc</function>, - <function>array_diff_key</function>, - <function>array_intersect</function>, - <function>array_intersect_assoc</function>, - <function>array_intersect_uassoc</function>, - <function>array_intersect_key</function> and - <function>array_intersect_ukey</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <note> + <simpara> + Please note that this function only checks one dimension of a n-dimensional + array. Of course you can check deeper dimensions by using + <literal>array_diff_ukey($array1[0], $array2[0], 'callback_func');</literal>. + </simpara> + </note> + <para> + See also <function>array_diff</function>, + <function>array_udiff</function> + <function>array_diff_assoc</function>, + <function>array_diff_uassoc</function>, + <function>array_udiff_assoc</function>, + <function>array_udiff_uassoc</function>, + <function>array_diff_key</function>, + <function>array_intersect</function>, + <function>array_intersect_assoc</function>, + <function>array_intersect_uassoc</function>, + <function>array_intersect_key</function> and + <function>array_intersect_ukey</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-diff.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-diff.xml diff -u phpdoc/en/reference/array/functions/array-diff.xml:1.11 phpdoc/en/reference/array/functions/array-diff.xml:1.12 --- phpdoc/en/reference/array/functions/array-diff.xml:1.11 Wed Dec 3 11:24:18 2003 +++ phpdoc/en/reference/array/functions/array-diff.xml Tue Oct 31 11:24:01 2006 @@ -1,29 +1,29 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> - <refentry id="function.array-diff"> - <refnamediv> - <refname>array_diff</refname> - <refpurpose>Computes the difference of arrays</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_diff</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_diff</function> returns an array - containing all the values of <parameter>array1</parameter> - that are not present in any of the other arguments. - Note that keys are preserved. - </para> - <para> - <example> - <title><function>array_diff</function> example</title> - <programlisting role="php"> +<refentry id="function.array-diff"> + <refnamediv> + <refname>array_diff</refname> + <refpurpose>Computes the difference of arrays</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_diff</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_diff</function> returns an array + containing all the values of <parameter>array1</parameter> + that are not present in any of the other arguments. + Note that keys are preserved. + </para> + <para> + <example> + <title><function>array_diff</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array("a" => "green", "red", "blue", "red"); @@ -33,49 +33,49 @@ print_r($result); ?> ]]> - </programlisting> - <para> - Multiple occurrences in $array1 are all treated the same way. - This will output : - </para> - <screen> + </programlisting> + <para> + Multiple occurrences in $array1 are all treated the same way. + This will output : + </para> + <screen> <![CDATA[ Array ( [1] => blue ) ]]> - </screen> - </example> - </para> - <note> - <simpara> - Two elements are considered equal if and only if - <literal>(string) $elem1 === (string) $elem2</literal>. In words: - when the string representation is the same. - <!-- TODO: example of it... --> - </simpara> - </note> - <note> - <simpara> - Please note that this function only checks one dimension of a n-dimensional - array. Of course you can check deeper dimensions by using - <literal>array_diff($array1[0], $array2[0]);</literal>. - </simpara> - </note> - <warning> - <simpara> - This was broken in PHP 4.0.4! - <!-- TODO: when exactly was this broken?... --> - </simpara> - </warning> - <para> - See also <function>array_diff_assoc</function>, - <function>array_intersect</function>, and - <function>array_intersect_assoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <note> + <simpara> + Two elements are considered equal if and only if + <literal>(string) $elem1 === (string) $elem2</literal>. In words: + when the string representation is the same. + <!-- TODO: example of it... --> + </simpara> + </note> + <note> + <simpara> + Please note that this function only checks one dimension of a n-dimensional + array. Of course you can check deeper dimensions by using + <literal>array_diff($array1[0], $array2[0]);</literal>. + </simpara> + </note> + <warning> + <simpara> + This was broken in PHP 4.0.4! + <!-- TODO: when exactly was this broken?... --> + </simpara> + </warning> + <para> + See also <function>array_diff_assoc</function>, + <function>array_intersect</function>, and + <function>array_intersect_assoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-fill.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/array-fill.xml diff -u phpdoc/en/reference/array/functions/array-fill.xml:1.9 phpdoc/en/reference/array/functions/array-fill.xml:1.10 --- phpdoc/en/reference/array/functions/array-fill.xml:1.9 Fri Jul 25 16:38:56 2003 +++ phpdoc/en/reference/array/functions/array-fill.xml Tue Oct 31 11:24:01 2006 @@ -1,42 +1,42 @@ <?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.array-fill"> - <refnamediv> - <refname>array_fill</refname> - <refpurpose>Fill an array with values</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_fill</methodname> - <methodparam><type>int</type><parameter>start_index</parameter></methodparam> - <methodparam><type>int</type><parameter>num</parameter></methodparam> - <methodparam><type>mixed</type><parameter>value</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_fill</function> fills an array with - <parameter>num</parameter> entries of the value of the - <parameter>value</parameter> parameter, keys starting at the - <parameter>start_index</parameter> parameter. Note that <parameter> - num</parameter> must be a number greater than zero, or PHP will throw - a warning. - </para> - <para> - <example> - <title><function>array_fill</function> example</title> - <programlisting role="php"> +<refentry id="function.array-fill"> + <refnamediv> + <refname>array_fill</refname> + <refpurpose>Fill an array with values</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_fill</methodname> + <methodparam><type>int</type><parameter>start_index</parameter></methodparam> + <methodparam><type>int</type><parameter>num</parameter></methodparam> + <methodparam><type>mixed</type><parameter>value</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_fill</function> fills an array with + <parameter>num</parameter> entries of the value of the + <parameter>value</parameter> parameter, keys starting at the + <parameter>start_index</parameter> parameter. Note that <parameter> + num</parameter> must be a number greater than zero, or PHP will throw + a warning. + </para> + <para> + <example> + <title><function>array_fill</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $a = array_fill(5, 6, 'banana'); print_r($a); ?> ]]> - </programlisting> - <para> - <varname>$a</varname> now is: - </para> - <screen> + </programlisting> + <para> + <varname>$a</varname> now is: + </para> + <screen> <![CDATA[ Array ( @@ -48,15 +48,15 @@ [10] => banana ) ]]> - </screen> - </example> - </para> - <para> - See also <function>str_repeat</function> and - <function>range</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>str_repeat</function> and + <function>range</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-filter.xml?r1=1.17&r2=1.18&diff_format=u Index: phpdoc/en/reference/array/functions/array-filter.xml diff -u phpdoc/en/reference/array/functions/array-filter.xml:1.17 phpdoc/en/reference/array/functions/array-filter.xml:1.18 --- phpdoc/en/reference/array/functions/array-filter.xml:1.17 Fri Jun 16 14:44:47 2006 +++ phpdoc/en/reference/array/functions/array-filter.xml Tue Oct 31 11:24:01 2006 @@ -1,40 +1,38 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.17 $ --> +<!-- $Revision: 1.18 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.62 --> - <refentry id="function.array-filter"> - <refnamediv> - <refname>array_filter</refname> - <refpurpose> - Filters elements of an array using a callback function - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_filter</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam choice="opt"><type>callback</type><parameter>callback</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_filter</function> iterates over each value in - the <parameter>input</parameter> array passing them to the - <parameter>callback</parameter> function. If the <parameter> - callback</parameter> function returns true, the current - value from <parameter>input</parameter> is returned into the - result array. Array keys are preserved. - </para> - <para> - <example> - <title><function>array_filter</function> example</title> - <programlisting role="php"> +<refentry id="function.array-filter"> + <refnamediv> + <refname>array_filter</refname> + <refpurpose>Filters elements of an array using a callback function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_filter</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam choice="opt"><type>callback</type><parameter>callback</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_filter</function> iterates over each value in + the <parameter>input</parameter> array passing them to the + <parameter>callback</parameter> function. If the <parameter> + callback</parameter> function returns true, the current + value from <parameter>input</parameter> is returned into the + result array. Array keys are preserved. + </para> + <para> + <example> + <title><function>array_filter</function> example</title> + <programlisting role="php"> <![CDATA[ <?php -function odd($var) +function odd($var) { return($var & 1); } -function even($var) +function even($var) { return(!($var & 1)); } @@ -48,9 +46,9 @@ print_r(array_filter($array2, "even")); ?> ]]> - </programlisting> - &example.outputs; - <screen role="php"> + </programlisting> + &example.outputs; + <screen role="php"> <![CDATA[ Odd : Array @@ -68,27 +66,27 @@ [6] => 12 ) ]]> - </screen> - </example> - </para> - <para> - Users may not change the array itself from the callback - function. e.g. Add/delete an element, unset the array that - <function>array_filter</function> is applied to. If the array - is changed, the behavior of this function is undefined. - </para> - <para> - If the <parameter>callback</parameter> function is not supplied, - <function>array_filter</function> will remove all the entries of - <parameter>input</parameter> that are equal to &false;. See <link - linkend="language.types.boolean.casting">converting to boolean</link> - for more information. - </para> - <para> - <example> - <title><function>array_filter</function> without - <parameter>callback</parameter></title> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + Users may not change the array itself from the callback + function. e.g. Add/delete an element, unset the array that + <function>array_filter</function> is applied to. If the array + is changed, the behavior of this function is undefined. + </para> + <para> + If the <parameter>callback</parameter> function is not supplied, + <function>array_filter</function> will remove all the entries of + <parameter>input</parameter> that are equal to &false;. See <link + linkend="language.types.boolean.casting">converting to boolean</link> + for more information. + </para> + <para> + <example> + <title><function>array_filter</function> without + <parameter>callback</parameter></title> + <programlisting role="php"> <![CDATA[ <?php @@ -103,9 +101,9 @@ print_r(array_filter($entry)); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -113,15 +111,15 @@ [2] => -1 ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_map</function>, - <function>array_reduce</function>, and <function>array_walk</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_map</function>, + <function>array_reduce</function>, and <function>array_walk</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-flip.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-flip.xml diff -u phpdoc/en/reference/array/functions/array-flip.xml:1.11 phpdoc/en/reference/array/functions/array-flip.xml:1.12 --- phpdoc/en/reference/array/functions/array-flip.xml:1.11 Sun Aug 17 12:21:03 2003 +++ phpdoc/en/reference/array/functions/array-flip.xml Tue Oct 31 11:24:01 2006 @@ -1,54 +1,54 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.107 --> - <refentry id="function.array-flip"> - <refnamediv> - <refname>array_flip</refname> - <refpurpose>Exchanges all keys with their associated values in an array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_flip</methodname> - <methodparam><type>array</type><parameter>trans</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_flip</function> returns an <type>array</type> in flip - order, i.e. keys from <parameter>trans</parameter> become values and values - from <parameter>trans</parameter> become keys. - </para> - <para> - Note that the values of <parameter>trans</parameter> need to be valid - keys, i.e. they need to be either <type>integer</type> or - <type>string</type>. A warning will be emitted if a value has the wrong - type, and the key/value pair in question <emphasis>will not be - flipped</emphasis>. - </para> - <para> - If a value has several occurrences, the latest key will be - used as its values, and all others will be lost. - </para> - <para> - <function>array_flip</function> returns &false; - if it fails. - </para> - <para> - <example> - <title><function>array_flip</function> example</title> - <programlisting role="php"> +<refentry id="function.array-flip"> + <refnamediv> + <refname>array_flip</refname> + <refpurpose>Exchanges all keys with their associated values in an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_flip</methodname> + <methodparam><type>array</type><parameter>trans</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_flip</function> returns an <type>array</type> in flip + order, i.e. keys from <parameter>trans</parameter> become values and values + from <parameter>trans</parameter> become keys. + </para> + <para> + Note that the values of <parameter>trans</parameter> need to be valid + keys, i.e. they need to be either <type>integer</type> or + <type>string</type>. A warning will be emitted if a value has the wrong + type, and the key/value pair in question <emphasis>will not be + flipped</emphasis>. + </para> + <para> + If a value has several occurrences, the latest key will be + used as its values, and all others will be lost. + </para> + <para> + <function>array_flip</function> returns &false; + if it fails. + </para> + <para> + <example> + <title><function>array_flip</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $trans = array_flip($trans); $original = strtr($str, $trans); ?> ]]> - </programlisting> - </example> - </para> - <para> - <example> - <title><function>array_flip</function> example : collision</title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + <example> + <title><function>array_flip</function> example : collision</title> + <programlisting role="php"> <![CDATA[ <?php $trans = array("a" => 1, "b" => 1, "c" => 2); @@ -56,11 +56,11 @@ print_r($trans); ?> ]]> - </programlisting> - <para> - now <varname>$trans</varname> is: - </para> - <screen> + </programlisting> + <para> + now <varname>$trans</varname> is: + </para> + <screen> <![CDATA[ Array ( @@ -68,16 +68,16 @@ [2] => c ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_values</function>, - <function>array_keys</function>, and - <function>array_reverse</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_values</function>, + <function>array_keys</function>, and + <function>array_reverse</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-intersect-assoc.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/array/functions/array-intersect-assoc.xml diff -u phpdoc/en/reference/array/functions/array-intersect-assoc.xml:1.8 phpdoc/en/reference/array/functions/array-intersect-assoc.xml:1.9 --- phpdoc/en/reference/array/functions/array-intersect-assoc.xml:1.8 Sun Jan 2 20:36:02 2005 +++ phpdoc/en/reference/array/functions/array-intersect-assoc.xml Tue Oct 31 11:24:01 2006 @@ -1,28 +1,28 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> - <refentry id="function.array-intersect-assoc"> - <refnamediv> - <refname>array_intersect_assoc</refname> - <refpurpose>Computes the intersection of arrays with additional index check</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_intersect_assoc</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - </methodsynopsis> - <simpara> - <function>array_intersect_assoc</function> returns an array - containing all the values of <parameter>array1</parameter> - that are present in all the arguments. Note that the keys are used in - the comparison unlike in <function>array_intersect</function>. - </simpara> - <para> - <example> - <title><function>array_intersect_assoc</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.9 $ --> +<refentry id="function.array-intersect-assoc"> + <refnamediv> + <refname>array_intersect_assoc</refname> + <refpurpose>Computes the intersection of arrays with additional index check</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_intersect_assoc</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + </methodsynopsis> + <simpara> + <function>array_intersect_assoc</function> returns an array + containing all the values of <parameter>array1</parameter> + that are present in all the arguments. Note that the keys are used in + the comparison unlike in <function>array_intersect</function>. + </simpara> + <para> + <example> + <title><function>array_intersect_assoc</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); @@ -30,46 +30,46 @@ $result_array = array_intersect_assoc($array1, $array2); ?> ]]> - </programlisting> - <para> - $result_array will look like: - </para> - <screen> + </programlisting> + <para> + $result_array will look like: + </para> + <screen> <![CDATA[ Array ( [a] => green ) ]]> - </screen> - </example> - </para> - <simpara> - In our example you see that only the pair <literal>"a" =&gt; - "green"</literal> is present in both arrays and thus is returned. - The value <literal>"red"</literal> is not returned because in - <varname>$array1</varname> its key is <literal>0</literal> while - the key of "red" in <varname>$array2</varname> is - <literal>1</literal>. - </simpara> - <simpara> - The two values from the <literal>key =&gt; value</literal> pairs are - considered equal only if - <literal>(string) $elem1 === (string) $elem2 </literal>. In other words - a strict type check is executed so the string representation must be - the same. - <!-- TODO: example of it... --> - </simpara> - <simpara> - See also <function>array_intersect</function>, - <function>array_uintersect_assoc</function>, - <function>array_intersect_uassoc</function>, - <function>array_uintersect_uassoc</function>, - <function>array_diff</function> and - <function>array_diff_assoc</function>. - </simpara> - </refsect1> - </refentry> + </screen> + </example> + </para> + <simpara> + In our example you see that only the pair <literal>"a" =&gt; + "green"</literal> is present in both arrays and thus is returned. + The value <literal>"red"</literal> is not returned because in + <varname>$array1</varname> its key is <literal>0</literal> while + the key of "red" in <varname>$array2</varname> is + <literal>1</literal>. + </simpara> + <simpara> + The two values from the <literal>key =&gt; value</literal> pairs are + considered equal only if + <literal>(string) $elem1 === (string) $elem2 </literal>. In other words + a strict type check is executed so the string representation must be + the same. + <!-- TODO: example of it... --> + </simpara> + <simpara> + See also <function>array_intersect</function>, + <function>array_uintersect_assoc</function>, + <function>array_intersect_uassoc</function>, + <function>array_uintersect_uassoc</function>, + <function>array_diff</function> and + <function>array_diff_assoc</function>. + </simpara> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-intersect-key.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/array/functions/array-intersect-key.xml diff -u phpdoc/en/reference/array/functions/array-intersect-key.xml:1.2 phpdoc/en/reference/array/functions/array-intersect-key.xml:1.3 --- phpdoc/en/reference/array/functions/array-intersect-key.xml:1.2 Mon Nov 1 12:39:24 2004 +++ phpdoc/en/reference/array/functions/array-intersect-key.xml Tue Oct 31 11:24:01 2006 @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> - <refentry id="function.array-intersect-key"> - <refnamediv> - <refname>array_intersect_key</refname> - <refpurpose>Computes the intersection of arrays using keys for comparison</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_intersect_key</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_intersect_key</function> returns an array - containing all the values of <parameter>array1</parameter> - which have matching keys that are present in all the arguments. - </para> - <para> - <example> - <title><function>array_intersect_key</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.3 $ --> +<refentry id="function.array-intersect-key"> + <refnamediv> + <refname>array_intersect_key</refname> + <refpurpose>Computes the intersection of arrays using keys for comparison</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_intersect_key</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_intersect_key</function> returns an array + containing all the values of <parameter>array1</parameter> + which have matching keys that are present in all the arguments. + </para> + <para> + <example> + <title><function>array_intersect_key</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); @@ -30,9 +30,9 @@ var_dump(array_intersect_key($array1, $array2)); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ array(2) { ["blue"]=> @@ -41,40 +41,40 @@ int(3) }) ]]> - </screen> - </example> - </para> - <para> - In our example you see that only the keys <literal>'blue'</literal> - and <literal>'green'</literal> are present in both arrays and thus - returned. Also notice that the values for the keys - <literal>'blue'</literal> and <literal>'green'</literal> differ between - the two arrays. A match still occurs because only the keys are checked. - The values returned are those of <parameter>array1</parameter>. - </para> - <para> - The two keys from the <literal>key =&gt; value</literal> pairs are - considered equal only if - <literal>(string) $key1 === (string) $key2 </literal>. In other words - a strict type check is executed so the string representation must be - the same. - </para> - <para> - See also <function>array_diff</function>, - <function>array_udiff</function> - <function>array_diff_assoc</function>, - <function>array_diff_uassoc</function>, - <function>array_udiff_assoc</function>, - <function>array_udiff_uassoc</function>, - <function>array_diff_key</function>, - <function>array_diff_ukey</function>, - <function>array_intersect</function>, - <function>array_intersect_assoc</function>, - <function>array_intersect_uassoc</function> and - <function>array_intersect_ukey</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + In our example you see that only the keys <literal>'blue'</literal> + and <literal>'green'</literal> are present in both arrays and thus + returned. Also notice that the values for the keys + <literal>'blue'</literal> and <literal>'green'</literal> differ between + the two arrays. A match still occurs because only the keys are checked. + The values returned are those of <parameter>array1</parameter>. + </para> + <para> + The two keys from the <literal>key =&gt; value</literal> pairs are + considered equal only if + <literal>(string) $key1 === (string) $key2 </literal>. In other words + a strict type check is executed so the string representation must be + the same. + </para> + <para> + See also <function>array_diff</function>, + <function>array_udiff</function> + <function>array_diff_assoc</function>, + <function>array_diff_uassoc</function>, + <function>array_udiff_assoc</function>, + <function>array_udiff_uassoc</function>, + <function>array_diff_key</function>, + <function>array_diff_ukey</function>, + <function>array_intersect</function>, + <function>array_intersect_assoc</function>, + <function>array_intersect_uassoc</function> and + <function>array_intersect_ukey</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-intersect-uassoc.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/array/functions/array-intersect-uassoc.xml diff -u phpdoc/en/reference/array/functions/array-intersect-uassoc.xml:1.4 phpdoc/en/reference/array/functions/array-intersect-uassoc.xml:1.5 --- phpdoc/en/reference/array/functions/array-intersect-uassoc.xml:1.4 Mon Nov 1 12:39:24 2004 +++ phpdoc/en/reference/array/functions/array-intersect-uassoc.xml Tue Oct 31 11:24:01 2006 @@ -1,35 +1,35 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> - <refentry id="function.array-intersect-uassoc"> - <refnamediv> - <refname>array_intersect_uassoc</refname> - <refpurpose>Computes the intersection of arrays with additional index check, compares indexes by a callback function</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_intersect_uassoc</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_intersect_uassoc</function> returns an array - containing all the values of <parameter>array1</parameter> - that are present in all the arguments. Note that the keys are used in - the comparison unlike in <function>array_intersect</function>. - </para> - <para> - The index comparison is done by a user supplied callback function. - It must return an integer less than, equal to, or greater than zero - if the first argument is considered to be respectively less than, - equal to, or greater than the second. - </para> - <para> - <example> - <title><function>array_intersect_uassoc</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.5 $ --> +<refentry id="function.array-intersect-uassoc"> + <refnamediv> + <refname>array_intersect_uassoc</refname> + <refpurpose>Computes the intersection of arrays with additional index check, compares indexes by a callback function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_intersect_uassoc</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_intersect_uassoc</function> returns an array + containing all the values of <parameter>array1</parameter> + that are present in all the arguments. Note that the keys are used in + the comparison unlike in <function>array_intersect</function>. + </para> + <para> + The index comparison is done by a user supplied callback function. + It must return an integer less than, equal to, or greater than zero + if the first argument is considered to be respectively less than, + equal to, or greater than the second. + </para> + <para> + <example> + <title><function>array_intersect_uassoc</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); @@ -38,28 +38,28 @@ print_r(array_intersect_uassoc($array1, $array2, "strcasecmp")); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( [b] => brown ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_intersect</function>, - <function>array_intersect_assoc</function>, - <function>array_uintersect_assoc</function>, - <function>array_uintersect_uassoc</function>, - <function>array_intersect_key</function> and - <function>array_intersect_ukey</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_intersect</function>, + <function>array_intersect_assoc</function>, + <function>array_uintersect_assoc</function>, + <function>array_uintersect_uassoc</function>, + <function>array_intersect_key</function> and + <function>array_intersect_ukey</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-intersect-ukey.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/array/functions/array-intersect-ukey.xml diff -u phpdoc/en/reference/array/functions/array-intersect-ukey.xml:1.3 phpdoc/en/reference/array/functions/array-intersect-ukey.xml:1.4 --- phpdoc/en/reference/array/functions/array-intersect-ukey.xml:1.3 Mon Apr 25 08:13:48 2005 +++ phpdoc/en/reference/array/functions/array-intersect-ukey.xml Tue Oct 31 11:24:01 2006 @@ -1,34 +1,34 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> - <refentry id="function.array-intersect-ukey"> - <refnamediv> - <refname>array_intersect_ukey</refname> - <refpurpose>Computes the intersection of arrays using a callback function on the keys for comparison</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_intersect_ukey</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> - <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_intersect_ukey</function> returns an array - containing all the values of <parameter>array1</parameter> - which have matching keys that are present in all the arguments. - </para> - <para> - This comparison is done by a user supplied callback function. - It must return an integer less than, equal to, or greater than zero if the - first key is considered to be respectively less than, equal to, or - greater than the second. - </para> - <para> - <example> - <title><function>array_intersect_ukey</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.4 $ --> +<refentry id="function.array-intersect-ukey"> + <refnamediv> + <refname>array_intersect_ukey</refname> + <refpurpose>Computes the intersection of arrays using a callback function on the keys for comparison</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_intersect_ukey</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> + <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_intersect_ukey</function> returns an array + containing all the values of <parameter>array1</parameter> + which have matching keys that are present in all the arguments. + </para> + <para> + This comparison is done by a user supplied callback function. + It must return an integer less than, equal to, or greater than zero if the + first key is considered to be respectively less than, equal to, or + greater than the second. + </para> + <para> + <example> + <title><function>array_intersect_ukey</function> example</title> + <programlisting role="php"> <![CDATA[ <?php function key_compare_func($key1, $key2) @@ -47,9 +47,9 @@ var_dump(array_intersect_ukey($array1, $array2, 'key_compare_func')); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ array(2) { ["blue"]=> @@ -58,33 +58,33 @@ int(3) }) ]]> - </screen> - </example> - </para> - <para> - In our example you see that only the keys <literal>'blue'</literal> - and <literal>'green'</literal> are present in both arrays and thus - returned. Also notice that the values for the keys - <literal>'blue'</literal> and <literal>'green'</literal> differ between - the two arrays. A match still occurs because only the keys are checked. - The values returned are those of <parameter>array1</parameter>. - </para> - <para> - See also <function>array_diff</function>, - <function>array_udiff</function> - <function>array_diff_assoc</function>, - <function>array_diff_uassoc</function>, - <function>array_udiff_assoc</function>, - <function>array_udiff_uassoc</function>, - <function>array_diff_key</function>, - <function>array_diff_ukey</function>, - <function>array_intersect</function>, - <function>array_intersect_assoc</function>, - <function>array_intersect_uassoc</function> and - <function>array_intersect_key</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + In our example you see that only the keys <literal>'blue'</literal> + and <literal>'green'</literal> are present in both arrays and thus + returned. Also notice that the values for the keys + <literal>'blue'</literal> and <literal>'green'</literal> differ between + the two arrays. A match still occurs because only the keys are checked. + The values returned are those of <parameter>array1</parameter>. + </para> + <para> + See also <function>array_diff</function>, + <function>array_udiff</function> + <function>array_diff_assoc</function>, + <function>array_diff_uassoc</function>, + <function>array_udiff_assoc</function>, + <function>array_udiff_uassoc</function>, + <function>array_diff_key</function>, + <function>array_diff_ukey</function>, + <function>array_intersect</function>, + <function>array_intersect_assoc</function>, + <function>array_intersect_uassoc</function> and + <function>array_intersect_key</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-intersect.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/array/functions/array-intersect.xml diff -u phpdoc/en/reference/array/functions/array-intersect.xml:1.10 phpdoc/en/reference/array/functions/array-intersect.xml:1.11 --- phpdoc/en/reference/array/functions/array-intersect.xml:1.10 Sun Aug 17 12:21:03 2003 +++ phpdoc/en/reference/array/functions/array-intersect.xml Tue Oct 31 11:24:01 2006 @@ -1,29 +1,29 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> - <refentry id="function.array-intersect"> - <refnamediv> - <refname>array_intersect</refname> - <refpurpose>Computes the intersection of arrays</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_intersect</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_intersect</function> returns an array - containing all the values of <parameter>array1</parameter> - that are present in all the arguments. - Note that keys are preserved. - </para> - <para> - <example> - <title><function>array_intersect</function> example</title> - <programlisting role="php"> +<refentry id="function.array-intersect"> + <refnamediv> + <refname>array_intersect</refname> + <refpurpose>Computes the intersection of arrays</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_intersect</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_intersect</function> returns an array + containing all the values of <parameter>array1</parameter> + that are present in all the arguments. + Note that keys are preserved. + </para> + <para> + <example> + <title><function>array_intersect</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array("a" => "green", "red", "blue"); @@ -31,11 +31,11 @@ $result = array_intersect($array1, $array2); ?> ]]> - </programlisting> - <para> - This makes <varname>$result</varname> have - </para> - <screen role="php"> + </programlisting> + <para> + This makes <varname>$result</varname> have + </para> + <screen role="php"> <![CDATA[ Array ( @@ -43,24 +43,24 @@ [0] => red ) ]]> - </screen> - </example> - </para> - <note> - <simpara> - Two elements are considered equal if and only if - <literal>(string) $elem1 === (string) $elem2</literal>. In words: - when the string representation is the same. - <!-- TODO: example of it... --> - </simpara> - </note> - <para> - See also <function>array_intersect_assoc</function>, - <function>array_diff</function>, and - <function>array_diff_assoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <note> + <simpara> + Two elements are considered equal if and only if + <literal>(string) $elem1 === (string) $elem2</literal>. In words: + when the string representation is the same. + <!-- TODO: example of it... --> + </simpara> + </note> + <para> + See also <function>array_intersect_assoc</function>, + <function>array_diff</function>, and + <function>array_diff_assoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-key-exists.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-key-exists.xml diff -u phpdoc/en/reference/array/functions/array-key-exists.xml:1.11 phpdoc/en/reference/array/functions/array-key-exists.xml:1.12 --- phpdoc/en/reference/array/functions/array-key-exists.xml:1.11 Mon Nov 8 12:10:18 2004 +++ phpdoc/en/reference/array/functions/array-key-exists.xml Tue Oct 31 11:24:01 2006 @@ -1,29 +1,29 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.119 --> - <refentry id="function.array-key-exists"> - <refnamediv> - <refname>array_key_exists</refname> - <refpurpose>Checks if the given key or index exists in the array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>array_key_exists</methodname> - <methodparam><type>mixed</type><parameter>key</parameter></methodparam> - <methodparam><type>array</type><parameter>search</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_key_exists</function> returns &true; if the - given <parameter>key</parameter> is set in the array. - <parameter>key</parameter> can be any value possible - for an array index. <function>array_key_exists</function> also works - on objects. - </para> - <para> - <example> - <title><function>array_key_exists</function> example</title> - <programlisting role="php"> +<refentry id="function.array-key-exists"> + <refnamediv> + <refname>array_key_exists</refname> + <refpurpose>Checks if the given key or index exists in the array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>array_key_exists</methodname> + <methodparam><type>mixed</type><parameter>key</parameter></methodparam> + <methodparam><type>array</type><parameter>search</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_key_exists</function> returns &true; if the + given <parameter>key</parameter> is set in the array. + <parameter>key</parameter> can be any value possible + for an array index. <function>array_key_exists</function> also works + on objects. + </para> + <para> + <example> + <title><function>array_key_exists</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $search_array = array('first' => 1, 'second' => 4); @@ -32,23 +32,23 @@ } ?> ]]> - </programlisting> - </example> - </para> - <note> - <simpara> - The name of this function is <function>key_exists</function> - in PHP 4.0.6. - </simpara> - </note> - <example> - <title><function>array_key_exists</function> vs <function>isset</function></title> - <para> - <function>isset</function> does not return &true; for array keys - that correspond to a &null; value, while - <function>array_key_exists</function> does. - </para> - <programlisting role="php"> + </programlisting> + </example> + </para> + <note> + <simpara> + The name of this function is <function>key_exists</function> + in PHP 4.0.6. + </simpara> + </note> + <example> + <title><function>array_key_exists</function> vs <function>isset</function></title> + <para> + <function>isset</function> does not return &true; for array keys + that correspond to a &null; value, while + <function>array_key_exists</function> does. + </para> + <programlisting role="php"> <![CDATA[ <?php $search_array = array('first' => null, 'second' => 4); @@ -60,15 +60,15 @@ array_key_exists('first', $search_array); ?> ]]> - </programlisting> - </example> - <para> - See also <function>isset</function>, - <function>array_keys</function>, and - <function>in_array</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + <para> + See also <function>isset</function>, + <function>array_keys</function>, and + <function>in_array</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-keys.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/array/functions/array-keys.xml diff -u phpdoc/en/reference/array/functions/array-keys.xml:1.10 phpdoc/en/reference/array/functions/array-keys.xml:1.11 --- phpdoc/en/reference/array/functions/array-keys.xml:1.10 Mon Nov 1 12:39:24 2004 +++ phpdoc/en/reference/array/functions/array-keys.xml Tue Oct 31 11:24:01 2006 @@ -1,34 +1,34 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-keys"> - <refnamediv> - <refname>array_keys</refname> - <refpurpose>Return all the keys of an array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_keys</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>search_value</parameter></methodparam> - <methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_keys</function> returns the keys, numeric and - string, from the <parameter>input</parameter> array. - </para> - <para> - If the optional <parameter>search_value</parameter> is specified, - then only the keys for that value are returned. Otherwise, all - the keys from the <parameter>input</parameter> are returned. - As of PHP 5, you can use <parameter>strict</parameter> parameter for - comparison including type (===). - </para> - <para> - <example> - <title><function>array_keys</function> example</title> - <programlisting role="php"> +<refentry id="function.array-keys"> + <refnamediv> + <refname>array_keys</refname> + <refpurpose>Return all the keys of an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_keys</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>search_value</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_keys</function> returns the keys, numeric and + string, from the <parameter>input</parameter> array. + </para> + <para> + If the optional <parameter>search_value</parameter> is specified, + then only the keys for that value are returned. Otherwise, all + the keys from the <parameter>input</parameter> are returned. + As of PHP 5, you can use <parameter>strict</parameter> parameter for + comparison including type (===). + </para> + <para> + <example> + <title><function>array_keys</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array = array(0 => 100, "color" => "red"); @@ -42,9 +42,9 @@ print_r(array_keys($array)); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -63,15 +63,15 @@ [1] => size ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_values</function> and - <function>array_key_exists</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_values</function> and + <function>array_key_exists</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-map.xml?r1=1.16&r2=1.17&diff_format=u Index: phpdoc/en/reference/array/functions/array-map.xml diff -u phpdoc/en/reference/array/functions/array-map.xml:1.16 phpdoc/en/reference/array/functions/array-map.xml:1.17 --- phpdoc/en/reference/array/functions/array-map.xml:1.16 Thu Mar 2 08:30:25 2006 +++ phpdoc/en/reference/array/functions/array-map.xml Tue Oct 31 11:24:01 2006 @@ -1,37 +1,35 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.62 --> - <refentry id="function.array-map"> - <refnamediv> - <refname>array_map</refname> - <refpurpose> - Applies the callback to the elements of the given arrays - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_map</methodname> - <methodparam><type>callback</type><parameter>callback</parameter></methodparam> - <methodparam><type>array</type><parameter>arr1</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_map</function> returns an array containing all - the elements of <parameter>arr1</parameter> after applying the - <parameter>callback</parameter> function to each one. - The number of parameters that the <parameter>callback</parameter> - function accepts - should match the number of arrays - passed to the <function>array_map</function> - </para> - <para> - <example> - <title><function>array_map</function> example</title> - <programlisting role="php"> +<refentry id="function.array-map"> + <refnamediv> + <refname>array_map</refname> + <refpurpose>Applies the callback to the elements of the given arrays</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_map</methodname> + <methodparam><type>callback</type><parameter>callback</parameter></methodparam> + <methodparam><type>array</type><parameter>arr1</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_map</function> returns an array containing all + the elements of <parameter>arr1</parameter> after applying the + <parameter>callback</parameter> function to each one. + The number of parameters that the <parameter>callback</parameter> + function accepts + should match the number of arrays + passed to the <function>array_map</function> + </para> + <para> + <example> + <title><function>array_map</function> example</title> + <programlisting role="php"> <![CDATA[ <?php -function cube($n) +function cube($n) { return($n * $n * $n); } @@ -41,11 +39,11 @@ print_r($b); ?> ]]> - </programlisting> - <para> - This makes <varname>$b</varname> have: - </para> - <screen> + </programlisting> + <para> + This makes <varname>$b</varname> have: + </para> + <screen> <![CDATA[ Array ( @@ -56,21 +54,21 @@ [4] => 125 ) ]]> - </screen> - </example> - </para> - <para> - <example> - <title><function>array_map</function> - using more arrays</title> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + <example> + <title><function>array_map</function> - using more arrays</title> + <programlisting role="php"> <![CDATA[ <?php -function show_Spanish($n, $m) +function show_Spanish($n, $m) { return("The number $n is called $m in Spanish"); } -function map_Spanish($n, $m) +function map_Spanish($n, $m) { return(array($n => $m)); } @@ -85,9 +83,9 @@ print_r($d); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ // printout of $c Array @@ -129,25 +127,25 @@ ) ]]> - </screen> - </example> - </para> - <para> - Usually when using two or more arrays, they should be of equal length - because the callback function is applied in parallel to the corresponding - elements. - If the arrays are of unequal length, the shortest one will be extended - with empty elements. - </para> - <para> - An interesting use of this function is to construct an array of arrays, - which can be easily performed by using &null; - as the name of the callback function - </para> - <para> - <example> - <title>Creating an array of arrays</title> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + Usually when using two or more arrays, they should be of equal length + because the callback function is applied in parallel to the corresponding + elements. + If the arrays are of unequal length, the shortest one will be extended + with empty elements. + </para> + <para> + An interesting use of this function is to construct an array of arrays, + which can be easily performed by using &null; + as the name of the callback function + </para> + <para> + <example> + <title>Creating an array of arrays</title> + <programlisting role="php"> <![CDATA[ <?php $a = array(1, 2, 3, 4, 5); @@ -158,9 +156,9 @@ print_r($d); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -201,18 +199,18 @@ ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_filter</function>, - <function>array_reduce</function>, - <function>array_walk</function>, - <function>create_function</function>, and - &seealso.callback;. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_filter</function>, + <function>array_reduce</function>, + <function>array_walk</function>, + <function>create_function</function>, and + &seealso.callback;. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-merge-recursive.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/array/functions/array-merge-recursive.xml diff -u phpdoc/en/reference/array/functions/array-merge-recursive.xml:1.8 phpdoc/en/reference/array/functions/array-merge-recursive.xml:1.9 --- phpdoc/en/reference/array/functions/array-merge-recursive.xml:1.8 Wed Jun 22 10:39:09 2005 +++ phpdoc/en/reference/array/functions/array-merge-recursive.xml Tue Oct 31 11:24:01 2006 @@ -1,35 +1,35 @@ <?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.12 --> - <refentry id="function.array-merge-recursive"> - <refnamediv> - <refname>array_merge_recursive</refname> - <refpurpose>Merge two or more arrays recursively</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_merge_recursive</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_merge_recursive</function> merges the elements of - one or more arrays together so that the values of one are appended - to the end of the previous one. It returns the resulting array. - </para> - <para> - If the input arrays have the same string keys, then the values for - these keys are merged together into an array, and this is done - recursively, so that if one of the values is an array itself, the - function will merge it with a corresponding entry in another array - too. If, however, the arrays have the same numeric key, the later - value will not overwrite the original value, but will be appended. - </para> - <para> - <example> - <title><function>array_merge_recursive</function> example</title> - <programlisting role="php"> +<refentry id="function.array-merge-recursive"> + <refnamediv> + <refname>array_merge_recursive</refname> + <refpurpose>Merge two or more arrays recursively</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_merge_recursive</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_merge_recursive</function> merges the elements of + one or more arrays together so that the values of one are appended + to the end of the previous one. It returns the resulting array. + </para> + <para> + If the input arrays have the same string keys, then the values for + these keys are merged together into an array, and this is done + recursively, so that if one of the values is an array itself, the + function will merge it with a corresponding entry in another array + too. If, however, the arrays have the same numeric key, the later + value will not overwrite the original value, but will be appended. + </para> + <para> + <example> + <title><function>array_merge_recursive</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $ar1 = array("color" => array("favorite" => "red"), 5); @@ -37,11 +37,11 @@ $result = array_merge_recursive($ar1, $ar2); ?> ]]> - </programlisting> - <para> - The <literal>$result</literal> will be: - </para> - <screen role="php"> + </programlisting> + <para> + The <literal>$result</literal> will be: + </para> + <screen role="php"> <![CDATA[ Array ( @@ -60,14 +60,14 @@ [1] => 10 ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_merge</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_merge</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-merge.xml?r1=1.18&r2=1.19&diff_format=u Index: phpdoc/en/reference/array/functions/array-merge.xml diff -u phpdoc/en/reference/array/functions/array-merge.xml:1.18 phpdoc/en/reference/array/functions/array-merge.xml:1.19 --- phpdoc/en/reference/array/functions/array-merge.xml:1.18 Tue Mar 8 07:21:17 2005 +++ phpdoc/en/reference/array/functions/array-merge.xml Tue Oct 31 11:24:01 2006 @@ -1,39 +1,39 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.18 $ --> +<!-- $Revision: 1.19 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-merge"> - <refnamediv> - <refname>array_merge</refname> - <refpurpose>Merge one or more arrays</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_merge</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_merge</function> merges the elements of one or - more arrays together so that the values of one are appended to - the end of the previous one. It returns the resulting array. - </para> - <para> - If the input arrays have the same string keys, then the later value for - that key will overwrite the previous one. If, however, the arrays - contain numeric keys, the later value will <emphasis - role="strong">not</emphasis> overwrite the original value, but will be - appended. - </para> - <para> - If only one array is given and the array is numerically indexed, the - keys get reindexed in a continuous way. - </para> - <para> - <example> - <title><function>array_merge</function> example</title> - <programlisting role="php"> +<refentry id="function.array-merge"> + <refnamediv> + <refname>array_merge</refname> + <refpurpose>Merge one or more arrays</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_merge</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_merge</function> merges the elements of one or + more arrays together so that the values of one are appended to + the end of the previous one. It returns the resulting array. + </para> + <para> + If the input arrays have the same string keys, then the later value for + that key will overwrite the previous one. If, however, the arrays + contain numeric keys, the later value will <emphasis + role="strong">not</emphasis> overwrite the original value, but will be + appended. + </para> + <para> + If only one array is given and the array is numerically indexed, the + keys get reindexed in a continuous way. + </para> + <para> + <example> + <title><function>array_merge</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array("color" => "red", 2, 4); @@ -42,9 +42,9 @@ print_r($result); ?> ]]> - </programlisting> - &example.outputs; - <screen role="php"> + </programlisting> + &example.outputs; + <screen role="php"> <![CDATA[ Array ( @@ -57,13 +57,13 @@ [4] => 4 ) ]]> - </screen> - </example> - </para> - <para> - <example> - <title>Simple <function>array_merge</function> example</title> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + <example> + <title>Simple <function>array_merge</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array(); @@ -71,23 +71,23 @@ $result = array_merge($array1, $array2); ?> ]]> - </programlisting> - <para> - Don't forget that numeric keys will be renumbered! - </para> - <screen role="php"> + </programlisting> + <para> + Don't forget that numeric keys will be renumbered! + </para> + <screen role="php"> <![CDATA[ Array ( [0] => data ) ]]> - </screen> - <para> - If you want to completely preserve the arrays and just want to append - them to each other, use the <literal>+</literal> operator: - </para> - <programlisting role="php"> + </screen> + <para> + If you want to completely preserve the arrays and just want to append + them to each other, use the <literal>+</literal> operator: + </para> + <programlisting role="php"> <![CDATA[ <?php $array1 = array(); @@ -95,30 +95,30 @@ $result = $array1 + $array2; ?> ]]> - </programlisting> - <para> - The numeric key will be preserved and thus the association remains. - </para> - <screen role="php"> + </programlisting> + <para> + The numeric key will be preserved and thus the association remains. + </para> + <screen role="php"> <![CDATA[ Array ( [1] => data ) ]]> - </screen> - </example> - </para> - <warning> - <para> - The behavior of <function>array_merge</function> was modified in PHP 5. Unlike PHP 4, <function>array_merge</function> - now only accepts parameters of type <type>array</type>. However, you can use typecasting - to merge other types. See the example below for details. - </para> - <para> - <example> - <title><function>array_merge</function> PHP 5 example</title> - <programlisting role="php"> + </screen> + </example> + </para> + <warning> + <para> + The behavior of <function>array_merge</function> was modified in PHP 5. Unlike PHP 4, <function>array_merge</function> + now only accepts parameters of type <type>array</type>. However, you can use typecasting + to merge other types. See the example below for details. + </para> + <para> + <example> + <title><function>array_merge</function> PHP 5 example</title> + <programlisting role="php"> <![CDATA[ <?php $beginning = 'foo'; @@ -127,9 +127,9 @@ print_r($result); ?> ]]> - </programlisting> - &example.outputs; - <screen role="php"> + </programlisting> + &example.outputs; + <screen role="php"> <![CDATA[ Array ( @@ -137,17 +137,17 @@ [1] => bar ) ]]> - </screen> - </example> - </para> - </warning> - <para> - See also <function>array_merge_recursive</function>, - <function>array_combine</function> and - <link linkend="language.operators.array">array operators</link>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + </warning> + <para> + See also <function>array_merge_recursive</function>, + <function>array_combine</function> and + <link linkend="language.operators.array">array operators</link>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-multisort.xml?r1=1.17&r2=1.18&diff_format=u Index: phpdoc/en/reference/array/functions/array-multisort.xml diff -u phpdoc/en/reference/array/functions/array-multisort.xml:1.17 phpdoc/en/reference/array/functions/array-multisort.xml:1.18 --- phpdoc/en/reference/array/functions/array-multisort.xml:1.17 Wed Apr 20 14:05:07 2005 +++ phpdoc/en/reference/array/functions/array-multisort.xml Tue Oct 31 11:24:01 2006 @@ -1,82 +1,82 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.17 $ --> +<!-- $Revision: 1.18 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.11 --> - <refentry id="function.array-multisort"> - <refnamediv> - <refname>array_multisort</refname> - <refpurpose>Sort multiple or multi-dimensional arrays</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>array_multisort</methodname> - <methodparam><type>array</type><parameter>ar1</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>arg</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> - <!-- Parameters don't need to be passed by reference --> - </methodsynopsis> - <para> - &return.success; - </para> - <para> - <function>array_multisort</function> can be used to sort several - arrays at once, or a multi-dimensional array by one or more - dimensions. - </para> - <para> - Associative (<type>string</type>) keys will be maintained, but numeric - keys will be re-indexed. - </para> - <para> - The input arrays are treated as columns of a table to be sorted - by rows - this resembles the functionality of SQL ORDER BY - clause. The first array is the primary one to sort by. The rows - (values) in that array that compare the same are sorted by the - next input array, and so on. - </para> - <para> - The argument structure of this function is a bit unusual, but - flexible. The first argument has to be an array. Subsequently, - each argument can be either an array or a sorting flag from the - following lists. - </para> - <para> - Sorting order flags: - <itemizedlist> - <listitem> - <simpara><constant>SORT_ASC</constant> - Sort in ascending order</simpara> - </listitem> - <listitem> - <simpara><constant>SORT_DESC</constant> - Sort in descending order</simpara> - </listitem> - </itemizedlist> - </para> - <para> - Sorting type flags: - <itemizedlist> - <listitem> - <simpara><constant>SORT_REGULAR</constant> - Compare items normally</simpara> - </listitem> - <listitem> - <simpara><constant>SORT_NUMERIC</constant> - Compare items numerically</simpara> - </listitem> - <listitem> - <simpara><constant>SORT_STRING</constant> - Compare items as strings</simpara> - </listitem> - </itemizedlist> - </para> - <para> - No two sorting flags of the same type can be specified after each - array. The sorting flags specified after an array argument apply - only to that array - they are reset to default <constant>SORT_ASC</constant> and - <constant>SORT_REGULAR</constant> before each new array argument. - </para> +<refentry id="function.array-multisort"> + <refnamediv> + <refname>array_multisort</refname> + <refpurpose>Sort multiple or multi-dimensional arrays</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>array_multisort</methodname> + <methodparam><type>array</type><parameter>ar1</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>arg</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> + <!-- Parameters don't need to be passed by reference --> + </methodsynopsis> + <para> + &return.success; + </para> + <para> + <function>array_multisort</function> can be used to sort several + arrays at once, or a multi-dimensional array by one or more + dimensions. + </para> + <para> + Associative (<type>string</type>) keys will be maintained, but numeric + keys will be re-indexed. + </para> + <para> + The input arrays are treated as columns of a table to be sorted + by rows - this resembles the functionality of SQL ORDER BY + clause. The first array is the primary one to sort by. The rows + (values) in that array that compare the same are sorted by the + next input array, and so on. + </para> + <para> + The argument structure of this function is a bit unusual, but + flexible. The first argument has to be an array. Subsequently, + each argument can be either an array or a sorting flag from the + following lists. + </para> + <para> + Sorting order flags: + <itemizedlist> + <listitem> + <simpara><constant>SORT_ASC</constant> - Sort in ascending order</simpara> + </listitem> + <listitem> + <simpara><constant>SORT_DESC</constant> - Sort in descending order</simpara> + </listitem> + </itemizedlist> + </para> + <para> + Sorting type flags: + <itemizedlist> + <listitem> + <simpara><constant>SORT_REGULAR</constant> - Compare items normally</simpara> + </listitem> + <listitem> + <simpara><constant>SORT_NUMERIC</constant> - Compare items numerically</simpara> + </listitem> + <listitem> + <simpara><constant>SORT_STRING</constant> - Compare items as strings</simpara> + </listitem> + </itemizedlist> + </para> + <para> + No two sorting flags of the same type can be specified after each + array. The sorting flags specified after an array argument apply + only to that array - they are reset to default <constant>SORT_ASC</constant> and + <constant>SORT_REGULAR</constant> before each new array argument. + </para> - <para> - <example> - <title>Sorting multiple arrays</title> - <programlisting role="php"> + <para> + <example> + <title>Sorting multiple arrays</title> + <programlisting role="php"> <![CDATA[ <?php $ar1 = array("10", 100, 100, "a"); @@ -87,14 +87,14 @@ var_dump($ar2); ?> ]]> - </programlisting> - <para> - In this example, after sorting, the first array will contain "10", - "a", 100, 100. The second array will contain 1, 1, "2", 3. The - entries in the second array corresponding to the identical - entries in the first array (100 and 100) were sorted as well. - </para> - <screen> + </programlisting> + <para> + In this example, after sorting, the first array will contain "10", + "a", 100, 100. The second array will contain 1, 1, "2", 3. The + entries in the second array corresponding to the identical + entries in the first array (100 and 100) were sorted as well. + </para> + <screen> <![CDATA[ array(4) { [0]=> string(2) "10" @@ -108,19 +108,19 @@ [2]=> string(1) "2" [3]=> int(3) } -]]> - </screen> - </example> - </para> +]]> + </screen> + </example> + </para> - <para> - <example> - <title>Sorting multi-dimensional array</title> - <programlisting role="php"> + <para> + <example> + <title>Sorting multi-dimensional array</title> + <programlisting role="php"> <![CDATA[ <?php $ar = array( - array("10", 11, 100, 100, "a"), + array("10", 11, 100, 100, "a"), array( 1, 2, "2", 3, 1) ); array_multisort($ar[0], SORT_ASC, SORT_STRING, @@ -128,14 +128,14 @@ var_dump($ar); ?> ]]> - </programlisting> - <para> - In this example, after sorting, the first array will transform to - "10", 100, 100, 11, "a" (it was sorted as strings in ascending - order). The second will contain 1, 3, "2", 2, 1 (sorted as numbers, - in descending order). - </para> - <screen> + </programlisting> + <para> + In this example, after sorting, the first array will transform to + "10", 100, 100, 11, "a" (it was sorted as strings in ascending + order). The second will contain 1, 3, "2", 2, 1 (sorted as numbers, + in descending order). + </para> + <screen> <![CDATA[ array(2) { [0]=> array(5) { @@ -154,22 +154,22 @@ } } ]]> - </screen> - </example> - </para> + </screen> + </example> + </para> + <para> + <example> + <title>Sorting database results</title> + <para> + For this example, each element in the <varname>data</varname> + array represents one row in a table. This type of dataset is typical + of database records. + </para> <para> - <example> - <title>Sorting database results</title> - <para> - For this example, each element in the <varname>data</varname> - array represents one row in a table. This type of dataset is typical - of database records. - </para> - <para> - Example data: - </para> - <screen> + Example data: + </para> + <screen> <![CDATA[ volume | edition -------+-------- @@ -180,12 +180,12 @@ 86 | 6 67 | 7 ]]> - </screen> - <para> - The data as an array, called <varname>data</varname>. This would usually, - for example, be obtained by looping with <function>mysql_fetch_assoc</function>. - </para> - <programlisting role="php"> + </screen> + <para> + The data as an array, called <varname>data</varname>. This would usually, + for example, be obtained by looping with <function>mysql_fetch_assoc</function>. + </para> + <programlisting role="php"> <![CDATA[ <?php $data[] = array('volume' => 67, 'edition' => 2); @@ -196,17 +196,17 @@ $data[] = array('volume' => 67, 'edition' => 7); ?> ]]> - </programlisting> - <para> - In this example, we will order by <varname>volume</varname> descending, - <varname>edition</varname> ascending. - </para> - <para> - We have an array of rows, but <function>array_multisort</function> - requires an array of columns, so we use the below code to obtain the - columns, then perform the sorting. - </para> - <programlisting role="php"> + </programlisting> + <para> + In this example, we will order by <varname>volume</varname> descending, + <varname>edition</varname> ascending. + </para> + <para> + We have an array of rows, but <function>array_multisort</function> + requires an array of columns, so we use the below code to obtain the + columns, then perform the sorting. + </para> + <programlisting role="php"> <![CDATA[ <?php // Obtain a list of columns @@ -220,11 +220,11 @@ array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data); ?> ]]> - </programlisting> - <para> - The dataset is now sorted, and will look like this: - </para> - <screen> + </programlisting> + <para> + The dataset is now sorted, and will look like this: + </para> + <screen> <![CDATA[ volume | edition -------+-------- @@ -235,24 +235,24 @@ 67 | 2 67 | 7 ]]> - </screen> - </example> - </para> + </screen> + </example> + </para> + <para> + <example> + <title>Case insensitive sorting</title> + <para> + Both <constant>SORT_STRING</constant> and + <constant>SORT_REGULAR</constant> are case sensitive, strings + starting with a capital letter will come before strings starting + with a lowercase letter. + </para> <para> - <example> - <title>Case insensitive sorting</title> - <para> - Both <constant>SORT_STRING</constant> and - <constant>SORT_REGULAR</constant> are case sensitive, strings - starting with a capital letter will come before strings starting - with a lowercase letter. - </para> - <para> - To perform a case insensitive search, force the sorting order to be - determined by a lowercase copy of the original array. - </para> - <programlisting role="php"> + To perform a case insensitive search, force the sorting order to be + determined by a lowercase copy of the original array. + </para> + <programlisting role="php"> <![CDATA[ <?php $array = array('Alpha', 'atomic', 'Beta', 'bank'); @@ -263,9 +263,9 @@ print_r($array); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -275,12 +275,12 @@ [3] => Beta ) ]]> - </screen> - </example> - </para> + </screen> + </example> + </para> - </refsect1> - </refentry> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-pad.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/array/functions/array-pad.xml diff -u phpdoc/en/reference/array/functions/array-pad.xml:1.8 phpdoc/en/reference/array/functions/array-pad.xml:1.9 --- phpdoc/en/reference/array/functions/array-pad.xml:1.8 Fri Apr 15 08:30:45 2005 +++ phpdoc/en/reference/array/functions/array-pad.xml Tue Oct 31 11:24:01 2006 @@ -1,37 +1,35 @@ <?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.array-pad"> - <refnamediv> - <refname>array_pad</refname> - <refpurpose> - Pad array to the specified length with a value - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_pad</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam><type>int</type><parameter>pad_size</parameter></methodparam> - <methodparam><type>mixed</type><parameter>pad_value</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_pad</function> returns a copy of the - <parameter>input</parameter> padded to size specified by - <parameter>pad_size</parameter> with value - <parameter>pad_value</parameter>. If - <parameter>pad_size</parameter> is positive then the array is - padded on the right, if it's negative then on the left. If the - absolute value of <parameter>pad_size</parameter> is less than or - equal to the length of the <parameter>input</parameter> then no - padding takes place. - It is possible to add most 1048576 elements at a time. - </para> - <para> - <example> - <title><function>array_pad</function> example</title> - <programlisting role="php"> +<refentry id="function.array-pad"> + <refnamediv> + <refname>array_pad</refname> + <refpurpose>Pad array to the specified length with a value</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_pad</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam><type>int</type><parameter>pad_size</parameter></methodparam> + <methodparam><type>mixed</type><parameter>pad_value</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_pad</function> returns a copy of the + <parameter>input</parameter> padded to size specified by + <parameter>pad_size</parameter> with value + <parameter>pad_value</parameter>. If + <parameter>pad_size</parameter> is positive then the array is + padded on the right, if it's negative then on the left. If the + absolute value of <parameter>pad_size</parameter> is less than or + equal to the length of the <parameter>input</parameter> then no + padding takes place. + It is possible to add most 1048576 elements at a time. + </para> + <para> + <example> + <title><function>array_pad</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $input = array(12, 10, 9); @@ -46,15 +44,15 @@ // not padded ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>array_fill</function> and - <function>range</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>array_fill</function> and + <function>range</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-pop.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-pop.xml diff -u phpdoc/en/reference/array/functions/array-pop.xml:1.11 phpdoc/en/reference/array/functions/array-pop.xml:1.12 --- phpdoc/en/reference/array/functions/array-pop.xml:1.11 Wed Nov 10 08:30:19 2004 +++ phpdoc/en/reference/array/functions/array-pop.xml Tue Oct 31 11:24:01 2006 @@ -1,31 +1,31 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-pop"> - <refnamediv> - <refname>array_pop</refname> - <refpurpose>Pop the element off the end of array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>array_pop</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_pop</function> pops and returns the last value of - the <parameter>array</parameter>, shortening the - <parameter>array</parameter> by one element. - If <parameter>array</parameter> is empty (or is not an array), - &null; will be returned. - </para> - - &array.resetspointer; - - <para> - <example> - <title><function>array_pop</function> example</title> - <programlisting role="php"> +<refentry id="function.array-pop"> + <refnamediv> + <refname>array_pop</refname> + <refpurpose>Pop the element off the end of array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>array_pop</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_pop</function> pops and returns the last value of + the <parameter>array</parameter>, shortening the + <parameter>array</parameter> by one element. + If <parameter>array</parameter> is empty (or is not an array), + &null; will be returned. + </para> + + &array.resetspointer; + + <para> + <example> + <title><function>array_pop</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $stack = array("orange", "banana", "apple", "raspberry"); @@ -33,11 +33,11 @@ print_r($stack); ?> ]]> - </programlisting> - <para> - After this, <varname>$stack</varname> will have only 3 elements: - </para> - <screen role="php"> + </programlisting> + <para> + After this, <varname>$stack</varname> will have only 3 elements: + </para> + <screen role="php"> <![CDATA[ Array ( @@ -46,20 +46,20 @@ [2] => apple ) ]]> - </screen> - <para> - and <literal>raspberry</literal> will be assigned to - <varname>$fruit</varname>. - </para> - </example> - </para> + </screen> <para> - See also <function>array_push</function>, - <function>array_shift</function>, and - <function>array_unshift</function>. + and <literal>raspberry</literal> will be assigned to + <varname>$fruit</varname>. </para> - </refsect1> - </refentry> + </example> + </para> + <para> + See also <function>array_push</function>, + <function>array_shift</function>, and + <function>array_unshift</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-product.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/array/functions/array-product.xml diff -u phpdoc/en/reference/array/functions/array-product.xml:1.1 phpdoc/en/reference/array/functions/array-product.xml:1.2 --- phpdoc/en/reference/array/functions/array-product.xml:1.1 Wed May 11 16:42:04 2005 +++ phpdoc/en/reference/array/functions/array-product.xml Tue Oct 31 11:24:01 2006 @@ -1,26 +1,24 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> - <refentry id="function.array-product"> - <refnamediv> - <refname>array_product</refname> - <refpurpose> - Calculate the product of values in an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>number</type><methodname>array_product</methodname> - <methodparam><type>array</type><parameter>array</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_product</function> returns the product of values - in an array as an integer or float. - </para> - <para> - <example> - <title><function>array_product</function> examples</title> - <programlisting role="php"> +<!-- $Revision: 1.2 $ --> +<refentry id="function.array-product"> + <refnamediv> + <refname>array_product</refname> + <refpurpose>Calculate the product of values in an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>number</type><methodname>array_product</methodname> + <methodparam><type>array</type><parameter>array</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_product</function> returns the product of values + in an array as an integer or float. + </para> + <para> + <example> + <title><function>array_product</function> examples</title> + <programlisting role="php"> <![CDATA[ <?php @@ -29,17 +27,17 @@ ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ product(a) = 384 ]]> - </screen> - </example> - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-push.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/en/reference/array/functions/array-push.xml diff -u phpdoc/en/reference/array/functions/array-push.xml:1.12 phpdoc/en/reference/array/functions/array-push.xml:1.13 --- phpdoc/en/reference/array/functions/array-push.xml:1.12 Sat Aug 13 19:06:21 2005 +++ phpdoc/en/reference/array/functions/array-push.xml Tue Oct 31 11:24:01 2006 @@ -1,43 +1,41 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-push"> - <refnamediv> - <refname>array_push</refname> - <refpurpose> - Push one or more elements onto the end of array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>int</type><methodname>array_push</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam><type>mixed</type><parameter>var</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_push</function> treats - <parameter>array</parameter> as a stack, and pushes the passed - variables onto the end of <parameter>array</parameter>. The - length of <parameter>array</parameter> increases by the number of - variables pushed. Has the same effect as: - <programlisting role="php"> +<refentry id="function.array-push"> + <refnamediv> + <refname>array_push</refname> + <refpurpose>Push one or more elements onto the end of array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>int</type><methodname>array_push</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam><type>mixed</type><parameter>var</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_push</function> treats + <parameter>array</parameter> as a stack, and pushes the passed + variables onto the end of <parameter>array</parameter>. The + length of <parameter>array</parameter> increases by the number of + variables pushed. Has the same effect as: + <programlisting role="php"> <![CDATA[ <?php $array[] = $var; ?> ]]> - </programlisting> - repeated for each <parameter>var</parameter>. - </para> - <para> - Returns the new number of elements in the array. - </para> - <para> - <example> - <title><function>array_push</function> example</title> - <programlisting role="php"> + </programlisting> + repeated for each <parameter>var</parameter>. + </para> + <para> + Returns the new number of elements in the array. + </para> + <para> + <example> + <title><function>array_push</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $stack = array("orange", "banana"); @@ -45,12 +43,12 @@ print_r($stack); ?> ]]> - </programlisting> - <para> - This example would result in <varname>$stack</varname> having - the following elements: - </para> - <screen role="php"> + </programlisting> + <para> + This example would result in <varname>$stack</varname> having + the following elements: + </para> + <screen role="php"> <![CDATA[ Array ( @@ -60,30 +58,30 @@ [3] => raspberry ) ]]> - </screen> - </example> - </para> - <note> - <simpara> - If you use <function>array_push</function> to add one element to the - array it's better to use <literal>$array[] = </literal> because in that - way there is no overhead of calling a function. - </simpara> - </note> - <note> - <simpara> - <function>array_push</function> will raise a warning if the first - argument is not an array. This differs from the - <literal>$var[]</literal> behaviour where a new array is created. - </simpara> - </note> - <para> - See also <function>array_pop</function>, - <function>array_shift</function>, and - <function>array_unshift</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <note> + <simpara> + If you use <function>array_push</function> to add one element to the + array it's better to use <literal>$array[] = </literal> because in that + way there is no overhead of calling a function. + </simpara> + </note> + <note> + <simpara> + <function>array_push</function> will raise a warning if the first + argument is not an array. This differs from the + <literal>$var[]</literal> behaviour where a new array is created. + </simpara> + </note> + <para> + See also <function>array_pop</function>, + <function>array_shift</function>, and + <function>array_unshift</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-rand.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/array-rand.xml diff -u phpdoc/en/reference/array/functions/array-rand.xml:1.9 phpdoc/en/reference/array/functions/array-rand.xml:1.10 --- phpdoc/en/reference/array/functions/array-rand.xml:1.9 Mon Dec 15 16:47:04 2003 +++ phpdoc/en/reference/array/functions/array-rand.xml Tue Oct 31 11:24:01 2006 @@ -1,40 +1,38 @@ <?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.13 --> - <refentry id="function.array-rand"> - <refnamediv> - <refname>array_rand</refname> - <refpurpose> - Pick one or more random entries out of an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>array_rand</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>num_req</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_rand</function> is rather useful when you want to - pick one or more random entries out of an array. It takes an - <parameter>input</parameter> array and an optional argument - <parameter>num_req</parameter> which specifies how many entries you - want to pick - if not specified, it defaults to 1. - </para> - <para> - If you are picking only one entry, <function>array_rand</function> - returns the key for a random entry. Otherwise, it returns an array - of keys for the random entries. This is done so that you can pick - random keys as well as values out of the array. - </para> - - &note.randomseed; +<refentry id="function.array-rand"> + <refnamediv> + <refname>array_rand</refname> + <refpurpose>Pick one or more random entries out of an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>array_rand</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>num_req</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_rand</function> is rather useful when you want to + pick one or more random entries out of an array. It takes an + <parameter>input</parameter> array and an optional argument + <parameter>num_req</parameter> which specifies how many entries you + want to pick - if not specified, it defaults to 1. + </para> + <para> + If you are picking only one entry, <function>array_rand</function> + returns the key for a random entry. Otherwise, it returns an array + of keys for the random entries. This is done so that you can pick + random keys as well as values out of the array. + </para> - <para> - <example> - <title><function>array_rand</function> example</title> - <programlisting role="php"> + &note.randomseed; + + <para> + <example> + <title><function>array_rand</function> example</title> + <programlisting role="php"> <![CDATA[ <?php srand((float) microtime() * 10000000); @@ -44,14 +42,14 @@ echo $input[$rand_keys[1]] . "\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>shuffle</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>shuffle</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-reduce.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/array-reduce.xml diff -u phpdoc/en/reference/array/functions/array-reduce.xml:1.9 phpdoc/en/reference/array/functions/array-reduce.xml:1.10 --- phpdoc/en/reference/array/functions/array-reduce.xml:1.9 Tue Sep 6 07:36:12 2005 +++ phpdoc/en/reference/array/functions/array-reduce.xml Tue Oct 31 11:24:01 2006 @@ -1,45 +1,42 @@ <?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.array-reduce"> - <refnamediv> - <refname>array_reduce</refname> - <refpurpose> - Iteratively reduce the array to a single value using a callback - function - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>array_reduce</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - <methodparam><type>callback</type><parameter>function</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>initial</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_reduce</function> applies iteratively the - <parameter>function</parameter> function to the elements of the - array <parameter>input</parameter>, so as to reduce the array to - a single value. If the optional <parameter>initial</parameter> is - available, it will be used at the beginning of the process, or as - a final result in case the array is empty. - If the array is empty and <parameter>initial</parameter> is not passed, - <function>array_reduce</function> returns &null;. - </para> - <para> - <example> - <title><function>array_reduce</function> example</title> - <programlisting role="php"> +<refentry id="function.array-reduce"> + <refnamediv> + <refname>array_reduce</refname> + <refpurpose>Iteratively reduce the array to a single value using a callback function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>array_reduce</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + <methodparam><type>callback</type><parameter>function</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>initial</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_reduce</function> applies iteratively the + <parameter>function</parameter> function to the elements of the + array <parameter>input</parameter>, so as to reduce the array to + a single value. If the optional <parameter>initial</parameter> is + available, it will be used at the beginning of the process, or as + a final result in case the array is empty. + If the array is empty and <parameter>initial</parameter> is not passed, + <function>array_reduce</function> returns &null;. + </para> + <para> + <example> + <title><function>array_reduce</function> example</title> + <programlisting role="php"> <![CDATA[ <?php -function rsum($v, $w) +function rsum($v, $w) { $v += $w; return $v; } -function rmul($v, $w) +function rmul($v, $w) { $v *= $w; return $v; @@ -52,23 +49,23 @@ $d = array_reduce($x, "rsum", 1); ?> ]]> - </programlisting> - </example> - </para> - <para> - This will result in <varname>$b</varname> containing - <literal>15</literal>, <varname>$c</varname> containing - <literal>1200</literal> (= 10*1*2*3*4*5), and - <varname>$d</varname> containing <literal>1</literal>. - </para> - <para> - See also <function>array_filter</function>, - <function>array_map</function>, - <function>array_unique</function>, and - <function>array_count_values</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + This will result in <varname>$b</varname> containing + <literal>15</literal>, <varname>$c</varname> containing + <literal>1200</literal> (= 10*1*2*3*4*5), and + <varname>$d</varname> containing <literal>1</literal>. + </para> + <para> + See also <function>array_filter</function>, + <function>array_map</function>, + <function>array_unique</function>, and + <function>array_count_values</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-reverse.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/array-reverse.xml diff -u phpdoc/en/reference/array/functions/array-reverse.xml:1.9 phpdoc/en/reference/array/functions/array-reverse.xml:1.10 --- phpdoc/en/reference/array/functions/array-reverse.xml:1.9 Mon Dec 15 16:47:04 2003 +++ phpdoc/en/reference/array/functions/array-reverse.xml Tue Oct 31 11:24:01 2006 @@ -1,30 +1,28 @@ <?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-reverse"> - <refnamediv> - <refname>array_reverse</refname> - <refpurpose> - Return an array with elements in reverse order - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_reverse</methodname> - <methodparam><type>array</type><parameter>array</parameter></methodparam> - <methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_reverse</function> takes input - <parameter>array</parameter> and returns a new array with the - order of the elements reversed, preserving the keys if - <parameter>preserve_keys</parameter> is &true;. - </para> - <para> - <example> - <title><function>array_reverse</function> example</title> - <programlisting role="php"> +<refentry id="function.array-reverse"> + <refnamediv> + <refname>array_reverse</refname> + <refpurpose>Return an array with elements in reverse order</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_reverse</methodname> + <methodparam><type>array</type><parameter>array</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_reverse</function> takes input + <parameter>array</parameter> and returns a new array with the + order of the elements reversed, preserving the keys if + <parameter>preserve_keys</parameter> is &true;. + </para> + <para> + <example> + <title><function>array_reverse</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $input = array("php", 4.0, array("green", "red")); @@ -32,15 +30,15 @@ $result_keyed = array_reverse($input, true); ?> ]]> - </programlisting> - <para> - This makes both <varname>$result</varname> and - <varname>$result_keyed</varname> have the same elements, but - note the difference between the keys. The printout of - <varname>$result</varname> and - <varname>$result_keyed</varname> will be: - </para> - <screen role="php"> + </programlisting> + <para> + This makes both <varname>$result</varname> and + <varname>$result_keyed</varname> have the same elements, but + note the difference between the keys. The printout of + <varname>$result</varname> and + <varname>$result_keyed</varname> will be: + </para> + <screen role="php"> <![CDATA[ Array ( @@ -65,19 +63,19 @@ [0] => php ) ]]> - </screen> - </example> - </para> - <note> - <para> - The second parameter was added in PHP 4.0.3. - </para> - </note> - <para> - See also <function>array_flip</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <note> + <para> + The second parameter was added in PHP 4.0.3. + </para> + </note> + <para> + See also <function>array_flip</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-search.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/array-search.xml diff -u phpdoc/en/reference/array/functions/array-search.xml:1.9 phpdoc/en/reference/array/functions/array-search.xml:1.10 --- phpdoc/en/reference/array/functions/array-search.xml:1.9 Tue May 4 19:56:18 2004 +++ phpdoc/en/reference/array/functions/array-search.xml Tue Oct 31 11:24:01 2006 @@ -1,56 +1,53 @@ <?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.array-search"> - <refnamediv> - <refname>array_search</refname> - <refpurpose> - Searches the array for a given value and returns the - corresponding key if successful - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>array_search</methodname> - <methodparam><type>mixed</type><parameter>needle</parameter></methodparam> - <methodparam><type>array</type><parameter>haystack</parameter></methodparam> - <methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam> - </methodsynopsis> - <para> - Searches <parameter>haystack</parameter> for - <parameter>needle</parameter> and returns the key if it is found in - the array, &false; otherwise. - </para> - <note> - <para> - If <parameter>needle</parameter> is a string, the comparison is done - in a case-sensitive manner. - </para> - </note> - <note> - <para> - Prior to PHP 4.2.0, <function>array_search</function> returns - &null; on failure instead of &false;. - </para> - </note> - <para> - If the optional third parameter <parameter>strict</parameter> is set to - &true; then the <function>array_search</function> - will also check the types of the <parameter>needle</parameter> - in the <parameter>haystack</parameter>. - </para> - <para> - If <parameter>needle</parameter> is found in - <parameter>haystack</parameter> more than once, the first matching key - is returned. To return the keys for all matching values, use - <function>array_keys</function> with the optional - <parameter>search_value</parameter> parameter instead. - </para> - <para> - <example> - <title><function>array_search</function> example</title> - <programlisting role="php"> +<refentry id="function.array-search"> + <refnamediv> + <refname>array_search</refname> + <refpurpose>Searches the array for a given value and returns the corresponding key if successful</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>array_search</methodname> + <methodparam><type>mixed</type><parameter>needle</parameter></methodparam> + <methodparam><type>array</type><parameter>haystack</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam> + </methodsynopsis> + <para> + Searches <parameter>haystack</parameter> for + <parameter>needle</parameter> and returns the key if it is found in + the array, &false; otherwise. + </para> + <note> + <para> + If <parameter>needle</parameter> is a string, the comparison is done + in a case-sensitive manner. + </para> + </note> + <note> + <para> + Prior to PHP 4.2.0, <function>array_search</function> returns + &null; on failure instead of &false;. + </para> + </note> + <para> + If the optional third parameter <parameter>strict</parameter> is set to + &true; then the <function>array_search</function> + will also check the types of the <parameter>needle</parameter> + in the <parameter>haystack</parameter>. + </para> + <para> + If <parameter>needle</parameter> is found in + <parameter>haystack</parameter> more than once, the first matching key + is returned. To return the keys for all matching values, use + <function>array_keys</function> with the optional + <parameter>search_value</parameter> parameter instead. + </para> + <para> + <example> + <title><function>array_search</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red'); @@ -59,18 +56,18 @@ $key = array_search('red', $array); // $key = 1; ?> ]]> - </programlisting> - </example> - </para> - &return.falseproblem; - <para> - See also <function>array_keys</function>, - <function>array_values</function>, - <function>array_key_exists</function>, and - <function>in_array</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + &return.falseproblem; + <para> + See also <function>array_keys</function>, + <function>array_values</function>, + <function>array_key_exists</function>, and + <function>in_array</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-shift.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-shift.xml diff -u phpdoc/en/reference/array/functions/array-shift.xml:1.11 phpdoc/en/reference/array/functions/array-shift.xml:1.12 --- phpdoc/en/reference/array/functions/array-shift.xml:1.11 Wed Nov 10 08:30:19 2004 +++ phpdoc/en/reference/array/functions/array-shift.xml Tue Oct 31 11:24:01 2006 @@ -1,33 +1,31 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-shift"> - <refnamediv> - <refname>array_shift</refname> - <refpurpose> - Shift an element off the beginning of array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>array_shift</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_shift</function> shifts the first value of the - <parameter>array</parameter> off and returns it, shortening the - <parameter>array</parameter> by one element and moving everything - down. All numerical array keys will be modified to start counting from zero - while literal keys won't be touched. If <parameter>array</parameter> is empty - (or is not an array), &null; will be returned. - </para> - - &array.resetspointer; - - <example> - <title><function>array_shift</function> example</title> - <programlisting role="php"> +<refentry id="function.array-shift"> + <refnamediv> + <refname>array_shift</refname> + <refpurpose>Shift an element off the beginning of array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>array_shift</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_shift</function> shifts the first value of the + <parameter>array</parameter> off and returns it, shortening the + <parameter>array</parameter> by one element and moving everything + down. All numerical array keys will be modified to start counting from zero + while literal keys won't be touched. If <parameter>array</parameter> is empty + (or is not an array), &null; will be returned. + </para> + + &array.resetspointer; + + <example> + <title><function>array_shift</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $stack = array("orange", "banana", "apple", "raspberry"); @@ -35,11 +33,11 @@ print_r($stack); ?> ]]> - </programlisting> - <para> - This would result in <varname>$stack</varname> having 3 elements left: - </para> - <screen role="php"> + </programlisting> + <para> + This would result in <varname>$stack</varname> having 3 elements left: + </para> + <screen role="php"> <![CDATA[ Array ( @@ -48,19 +46,19 @@ [2] => raspberry ) ]]> - </screen> - <para> - and <literal>orange</literal> will be assigned to - <varname>$fruit</varname>. - </para> - </example> - <para> - See also <function>array_unshift</function>, - <function>array_push</function>, and - <function>array_pop</function>. - </para> - </refsect1> - </refentry> + </screen> + <para> + and <literal>orange</literal> will be assigned to + <varname>$fruit</varname>. + </para> + </example> + <para> + See also <function>array_unshift</function>, + <function>array_push</function>, and + <function>array_pop</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-slice.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/en/reference/array/functions/array-slice.xml diff -u phpdoc/en/reference/array/functions/array-slice.xml:1.12 phpdoc/en/reference/array/functions/array-slice.xml:1.13 --- phpdoc/en/reference/array/functions/array-slice.xml:1.12 Sun Oct 15 05:12:35 2006 +++ phpdoc/en/reference/array/functions/array-slice.xml Tue Oct 31 11:24:01 2006 @@ -1,50 +1,50 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-slice"> - <refnamediv> - <refname>array_slice</refname> - <refpurpose>Extract a slice of the array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_slice</methodname> - <methodparam><type>array</type><parameter>array</parameter></methodparam> - <methodparam><type>int</type><parameter>offset</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> - <methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_slice</function> returns the sequence of elements - from the array <parameter>array</parameter> as specified by the - <parameter>offset</parameter> and <parameter>length</parameter> - parameters. - </para> - <para> - If <parameter>offset</parameter> is non-negative, the sequence will - start at that offset in the <parameter>array</parameter>. If - <parameter>offset</parameter> is negative, the sequence will - start that far from the end of the <parameter>array</parameter>. - </para> - <para> - If <parameter>length</parameter> is given and is positive, then - the sequence will have that many elements in it. If - <parameter>length</parameter> is given and is negative then the - sequence will stop that many elements from the end of the - array. If it is omitted, then the sequence will have everything - from <parameter>offset</parameter> up until the end of the - <parameter>array</parameter>. - </para> - <para> - Note that <function>array_slice</function> will reset numeric array - keys by default. Since PHP 5.0.2, you can change this behaviour by - setting <parameter>preserve_keys</parameter> to &true;. - </para> - <para> - <example> - <title><function>array_slice</function> examples</title> - <programlisting role="php"> +<refentry id="function.array-slice"> + <refnamediv> + <refname>array_slice</refname> + <refpurpose>Extract a slice of the array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_slice</methodname> + <methodparam><type>array</type><parameter>array</parameter></methodparam> + <methodparam><type>int</type><parameter>offset</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_slice</function> returns the sequence of elements + from the array <parameter>array</parameter> as specified by the + <parameter>offset</parameter> and <parameter>length</parameter> + parameters. + </para> + <para> + If <parameter>offset</parameter> is non-negative, the sequence will + start at that offset in the <parameter>array</parameter>. If + <parameter>offset</parameter> is negative, the sequence will + start that far from the end of the <parameter>array</parameter>. + </para> + <para> + If <parameter>length</parameter> is given and is positive, then + the sequence will have that many elements in it. If + <parameter>length</parameter> is given and is negative then the + sequence will stop that many elements from the end of the + array. If it is omitted, then the sequence will have everything + from <parameter>offset</parameter> up until the end of the + <parameter>array</parameter>. + </para> + <para> + Note that <function>array_slice</function> will reset numeric array + keys by default. Since PHP 5.0.2, you can change this behaviour by + setting <parameter>preserve_keys</parameter> to &true;. + </para> + <para> + <example> + <title><function>array_slice</function> examples</title> + <programlisting role="php"> <![CDATA[ <?php $input = array("a", "b", "c", "d", "e"); @@ -58,9 +58,9 @@ print_r(array_slice($input, 2, -1, true)); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -73,15 +73,15 @@ [3] => d ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_splice</function> and - <function>unset</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_splice</function> and + <function>unset</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-splice.xml?r1=1.16&r2=1.17&diff_format=u Index: phpdoc/en/reference/array/functions/array-splice.xml diff -u phpdoc/en/reference/array/functions/array-splice.xml:1.16 phpdoc/en/reference/array/functions/array-splice.xml:1.17 --- phpdoc/en/reference/array/functions/array-splice.xml:1.16 Mon Aug 29 15:36:01 2005 +++ phpdoc/en/reference/array/functions/array-splice.xml Tue Oct 31 11:24:01 2006 @@ -1,77 +1,72 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> - <refentry id="function.array-splice"> - <refnamediv> - <refname>array_splice</refname> - <refpurpose> - Remove a portion of the array and replace it with something - else - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_splice</methodname> - <methodparam><type>array</type><parameter role="reference">input</parameter></methodparam> - <methodparam><type>int</type><parameter>offset</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> - replacement - </parameter></methodparam> - </methodsynopsis> - <para> - <function>array_splice</function> removes the elements designated - by <parameter>offset</parameter> and - <parameter>length</parameter> from the - <parameter>input</parameter> array, and replaces them with the - elements of the <parameter>replacement</parameter> array, if - supplied. It returns an array containing the extracted elements. - Note that numeric keys in <parameter>input</parameter> are not preserved. - </para> - <para> - If <parameter>offset</parameter> is positive then the start of - removed portion is at that offset from the beginning of the - <parameter>input</parameter> array. If - <parameter>offset</parameter> is negative then it starts that far - from the end of the <parameter>input</parameter> array. - </para> - <para> - If <parameter>length</parameter> is omitted, removes everything - from <parameter>offset</parameter> to the end of the array. If - <parameter>length</parameter> is specified and is positive, then - that many elements will be removed. If - <parameter>length</parameter> is specified and is negative then - the end of the removed portion will be that many elements from - the end of the array. Tip: to remove everything from - <parameter>offset</parameter> to the end of the array when - <parameter>replacement</parameter> is also specified, use - <literal>count($input)</literal> for - <parameter>length</parameter>. - </para> - <para> - If <parameter>replacement</parameter> array is specified, then - the removed elements are replaced with elements from this array. - If <parameter>offset</parameter> and - <parameter>length</parameter> are such that nothing is removed, - then the elements from the <parameter>replacement</parameter> - array are inserted in the place specified by the - <parameter>offset</parameter>. Note that keys in replacement - array are not preserved. - If <parameter>replacement</parameter> is just one element it is - not necessary to put <literal>array()</literal> - around it, unless the element is an array itself. - </para> - <para> - The following statements change the values of <varname>$input</varname> - the same way: +<refentry id="function.array-splice"> + <refnamediv> + <refname>array_splice</refname> + <refpurpose>Remove a portion of the array and replace it with something else</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_splice</methodname> + <methodparam><type>array</type><parameter role="reference">input</parameter></methodparam> + <methodparam><type>int</type><parameter>offset</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>replacement</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_splice</function> removes the elements designated + by <parameter>offset</parameter> and + <parameter>length</parameter> from the + <parameter>input</parameter> array, and replaces them with the + elements of the <parameter>replacement</parameter> array, if + supplied. It returns an array containing the extracted elements. + Note that numeric keys in <parameter>input</parameter> are not preserved. + </para> + <para> + If <parameter>offset</parameter> is positive then the start of + removed portion is at that offset from the beginning of the + <parameter>input</parameter> array. If + <parameter>offset</parameter> is negative then it starts that far + from the end of the <parameter>input</parameter> array. + </para> + <para> + If <parameter>length</parameter> is omitted, removes everything + from <parameter>offset</parameter> to the end of the array. If + <parameter>length</parameter> is specified and is positive, then + that many elements will be removed. If + <parameter>length</parameter> is specified and is negative then + the end of the removed portion will be that many elements from + the end of the array. Tip: to remove everything from + <parameter>offset</parameter> to the end of the array when + <parameter>replacement</parameter> is also specified, use + <literal>count($input)</literal> for + <parameter>length</parameter>. + </para> + <para> + If <parameter>replacement</parameter> array is specified, then + the removed elements are replaced with elements from this array. + If <parameter>offset</parameter> and + <parameter>length</parameter> are such that nothing is removed, + then the elements from the <parameter>replacement</parameter> + array are inserted in the place specified by the + <parameter>offset</parameter>. Note that keys in replacement + array are not preserved. + If <parameter>replacement</parameter> is just one element it is + not necessary to put <literal>array()</literal> + around it, unless the element is an array itself. + </para> + <para> + The following statements change the values of <varname>$input</varname> + the same way: <table> <title><function>array_splice</function> equivalents</title> <tgroup cols="2"> <tbody> <row> <entry> - array_push($input, $x, $y) + array_push($input, $x, $y) </entry> <entry> array_splice($input, count($input), 0, array($x, $y)) @@ -79,7 +74,7 @@ </row> <row> <entry> - array_pop($input) + array_pop($input) </entry> <entry> array_splice($input, -1) @@ -109,17 +104,17 @@ array_splice($input, $x, 1, $y) </entry> </row> - </tbody> + </tbody> </tgroup> </table> - </para> - <para> - Returns the array consisting of removed elements. - </para> - <para> - <example> - <title><function>array_splice</function> examples</title> - <programlisting role="php"> + </para> + <para> + Returns the array consisting of removed elements. + </para> + <para> + <example> + <title><function>array_splice</function> examples</title> + <programlisting role="php"> <![CDATA[ <?php $input = array("red", "green", "blue", "yellow"); @@ -145,16 +140,16 @@ // "blue", "purple", "yellow"); ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>array_slice</function>, - <function>unset</function>, and - <function>array_merge</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>array_slice</function>, + <function>unset</function>, and + <function>array_merge</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-sum.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-sum.xml diff -u phpdoc/en/reference/array/functions/array-sum.xml:1.11 phpdoc/en/reference/array/functions/array-sum.xml:1.12 --- phpdoc/en/reference/array/functions/array-sum.xml:1.11 Mon Nov 1 12:39:25 2004 +++ phpdoc/en/reference/array/functions/array-sum.xml Tue Oct 31 11:24:01 2006 @@ -1,27 +1,25 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.59 --> - <refentry id="function.array-sum"> - <refnamediv> - <refname>array_sum</refname> - <refpurpose> - Calculate the sum of values in an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>number</type><methodname>array_sum</methodname> - <methodparam><type>array</type><parameter>array</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_sum</function> returns the sum of values - in an array as an integer or float. - </para> - <para> - <example> - <title><function>array_sum</function> examples</title> - <programlisting role="php"> +<refentry id="function.array-sum"> + <refnamediv> + <refname>array_sum</refname> + <refpurpose>Calculate the sum of values in an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>number</type><methodname>array_sum</methodname> + <methodparam><type>array</type><parameter>array</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_sum</function> returns the sum of values + in an array as an integer or float. + </para> + <para> + <example> + <title><function>array_sum</function> examples</title> + <programlisting role="php"> <![CDATA[ <?php $a = array(2, 4, 6, 8); @@ -31,26 +29,26 @@ echo "sum(b) = " . array_sum($b) . "\n"; ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ sum(a) = 20 sum(b) = 6.9 ]]> - </screen> - </example> - </para> - <note> - <para> - PHP versions prior to 4.2.1 modified the passed array - itself and converted strings to numbers (which most - of the time converted them to zero, depending on - their value). - </para> - </note> - </refsect1> - </refentry> + </screen> + </example> + </para> + <note> + <para> + PHP versions prior to 4.2.1 modified the passed array + itself and converted strings to numbers (which most + of the time converted them to zero, depending on + their value). + </para> + </note> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-udiff-assoc.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/array-udiff-assoc.xml diff -u phpdoc/en/reference/array/functions/array-udiff-assoc.xml:1.9 phpdoc/en/reference/array/functions/array-udiff-assoc.xml:1.10 --- phpdoc/en/reference/array/functions/array-udiff-assoc.xml:1.9 Mon Nov 1 12:39:25 2004 +++ phpdoc/en/reference/array/functions/array-udiff-assoc.xml Tue Oct 31 11:24:01 2006 @@ -1,45 +1,45 @@ <?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.14 --> - <refentry id="function.array-udiff-assoc"> - <refnamediv> - <refname>array_udiff_assoc</refname> - <refpurpose>Computes the difference of arrays with additional index check, compares data by a callback function</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_udiff_assoc</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_udiff_assoc</function> returns an <type>array</type> - containing all the values from <parameter>array1</parameter> - that are not present in any of the other arguments. - Note that the keys are used in the comparison unlike - <function>array_diff</function> and <function>array_udiff</function>. - The comparison of arrays' data is performed by using an user-supplied - callback. In this aspect the behaviour is opposite to the behaviour of - <function>array_diff_assoc</function> which uses internal function for - comparison. - </para> - <para> - <example> - <title><function>array_udiff_assoc</function> example</title> - <programlisting role="php"> +<refentry id="function.array-udiff-assoc"> + <refnamediv> + <refname>array_udiff_assoc</refname> + <refpurpose>Computes the difference of arrays with additional index check, compares data by a callback function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_udiff_assoc</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_udiff_assoc</function> returns an <type>array</type> + containing all the values from <parameter>array1</parameter> + that are not present in any of the other arguments. + Note that the keys are used in the comparison unlike + <function>array_diff</function> and <function>array_udiff</function>. + The comparison of arrays' data is performed by using an user-supplied + callback. In this aspect the behaviour is opposite to the behaviour of + <function>array_diff_assoc</function> which uses internal function for + comparison. + </para> + <para> + <example> + <title><function>array_udiff_assoc</function> example</title> + <programlisting role="php"> <![CDATA[ <?php class cr { private $priv_member; - function cr($val) + function cr($val) { $this->priv_member = $val; } - - function comp_func_cr($a, $b) + + function comp_func_cr($a, $b) { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; @@ -53,9 +53,9 @@ print_r($result); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -75,43 +75,43 @@ ) ) ]]> - </screen> - </example> - </para> - <simpara> - In our example above you see the <literal>"1" =&gt; new cr(4)</literal> - pair is present in both arrays and thus it is not in the ouput from the - function. - </simpara> - <simpara> - For comparison is used the user supplied callback function. - It must return an integer less than, equal - to, or greater than zero if the first argument is considered to - be respectively less than, equal to, or greater than the - second. - </simpara> - <note> - <simpara> - Please note that this function only checks one dimension of a n-dimensional - array. Of course you can check deeper dimensions by using, for example, - <literal>array_udiff_assoc($array1[0], $array2[0], "some_comparison_func");</literal>. - </simpara> - </note> - <para> - See also - <function>array_diff</function>, - <function>array_diff_assoc</function>, - <function>array_diff_uassoc</function>, - <function>array_udiff</function>, - <function>array_udiff_uassoc</function>, - <function>array_intersect</function>, - <function>array_intersect_assoc</function>, - <function>array_uintersect</function>, - <function>array_uintersect_assoc</function> and - <function>array_uintersect_uassoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <simpara> + In our example above you see the <literal>"1" =&gt; new cr(4)</literal> + pair is present in both arrays and thus it is not in the ouput from the + function. + </simpara> + <simpara> + For comparison is used the user supplied callback function. + It must return an integer less than, equal + to, or greater than zero if the first argument is considered to + be respectively less than, equal to, or greater than the + second. + </simpara> + <note> + <simpara> + Please note that this function only checks one dimension of a n-dimensional + array. Of course you can check deeper dimensions by using, for example, + <literal>array_udiff_assoc($array1[0], $array2[0], "some_comparison_func");</literal>. + </simpara> + </note> + <para> + See also + <function>array_diff</function>, + <function>array_diff_assoc</function>, + <function>array_diff_uassoc</function>, + <function>array_udiff</function>, + <function>array_udiff_uassoc</function>, + <function>array_intersect</function>, + <function>array_intersect_assoc</function>, + <function>array_uintersect</function>, + <function>array_uintersect_assoc</function> and + <function>array_uintersect_uassoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-udiff-uassoc.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-udiff-uassoc.xml diff -u phpdoc/en/reference/array/functions/array-udiff-uassoc.xml:1.11 phpdoc/en/reference/array/functions/array-udiff-uassoc.xml:1.12 --- phpdoc/en/reference/array/functions/array-udiff-uassoc.xml:1.11 Mon Nov 1 12:39:25 2004 +++ phpdoc/en/reference/array/functions/array-udiff-uassoc.xml Tue Oct 31 11:24:01 2006 @@ -1,56 +1,56 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> - <refentry id="function.array-udiff-uassoc"> - <refnamediv> - <refname>array_udiff_uassoc</refname> - <refpurpose>Computes the difference of arrays with additional index check, compares data and indexes by a callback function</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_udiff_uassoc</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> - <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_udiff_uassoc</function> returns an <type>array</type> - containing all the values from <parameter>array1</parameter> - that are not present in any of the other arguments. - Note that the keys are used in the comparison unlike - <function>array_diff</function> and <function>array_udiff</function>. - The comparison of arrays' data is performed by using an user-supplied - callback : <parameter>data_compare_func</parameter>. In this aspect - the behaviour is opposite to the behaviour of - <function>array_diff_assoc</function> which uses internal function for - comparison. The comparison of keys (indices) is done also by the - callback function <parameter>key_compare_func</parameter>. This - behaviour is unlike what <function>array_udiff_assoc</function> does, since - the latter compares the indices by using an internal function. - </para> - <para> - <example> - <title><function>array_udiff_uassoc</function> example</title> - <programlisting role="php"> +<refentry id="function.array-udiff-uassoc"> + <refnamediv> + <refname>array_udiff_uassoc</refname> + <refpurpose>Computes the difference of arrays with additional index check, compares data and indexes by a callback function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_udiff_uassoc</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> + <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_udiff_uassoc</function> returns an <type>array</type> + containing all the values from <parameter>array1</parameter> + that are not present in any of the other arguments. + Note that the keys are used in the comparison unlike + <function>array_diff</function> and <function>array_udiff</function>. + The comparison of arrays' data is performed by using an user-supplied + callback : <parameter>data_compare_func</parameter>. In this aspect + the behaviour is opposite to the behaviour of + <function>array_diff_assoc</function> which uses internal function for + comparison. The comparison of keys (indices) is done also by the + callback function <parameter>key_compare_func</parameter>. This + behaviour is unlike what <function>array_udiff_assoc</function> does, since + the latter compares the indices by using an internal function. + </para> + <para> + <example> + <title><function>array_udiff_uassoc</function> example</title> + <programlisting role="php"> <![CDATA[ <?php class cr { private $priv_member; - function cr($val) + function cr($val) { $this->priv_member = $val; } - function comp_func_cr($a, $b) + function comp_func_cr($a, $b) { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; } - - function comp_func_key($a, $b) + + function comp_func_key($a, $b) { if ($a === $b) return 0; return ($a > $b)? 1:-1; @@ -63,9 +63,9 @@ print_r($result); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -85,44 +85,44 @@ ) ) ]]> - </screen> - </example> - </para> - <simpara> - In our example above you see the <literal>"1" =&gt; new cr(4)</literal> - pair is present in both arrays and thus it is not in the ouput from the - function. Keep in mind that you have to supply 2 callback functions. - </simpara> - <simpara> - For comparison is used the user supplied callback function. - It must return an integer less than, equal - to, or greater than zero if the first argument is considered to - be respectively less than, equal to, or greater than the - second. - </simpara> - <note> - <simpara> - Please note that this function only checks one dimension of a n-dimensional - array. Of course you can check deeper dimensions by using, for example, - <literal>array_udiff_uassoc($array1[0], $array2[0], "data_compare_func", - "key_compare_func");</literal>. - </simpara> - </note> - <para> - See also - <function>array_diff</function>, - <function>array_diff_assoc</function>, - <function>array_diff_uassoc</function>, - <function>array_udiff</function>, - <function>array_udiff_assoc</function>, - <function>array_intersect</function>, - <function>array_intersect_assoc</function>, - <function>array_uintersect</function>, - <function>array_uintersect_assoc</function> and - <function>array_uintersect_uassoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <simpara> + In our example above you see the <literal>"1" =&gt; new cr(4)</literal> + pair is present in both arrays and thus it is not in the ouput from the + function. Keep in mind that you have to supply 2 callback functions. + </simpara> + <simpara> + For comparison is used the user supplied callback function. + It must return an integer less than, equal + to, or greater than zero if the first argument is considered to + be respectively less than, equal to, or greater than the + second. + </simpara> + <note> + <simpara> + Please note that this function only checks one dimension of a n-dimensional + array. Of course you can check deeper dimensions by using, for example, + <literal>array_udiff_uassoc($array1[0], $array2[0], "data_compare_func", + "key_compare_func");</literal>. + </simpara> + </note> + <para> + See also + <function>array_diff</function>, + <function>array_diff_assoc</function>, + <function>array_diff_uassoc</function>, + <function>array_udiff</function>, + <function>array_udiff_assoc</function>, + <function>array_intersect</function>, + <function>array_intersect_assoc</function>, + <function>array_uintersect</function>, + <function>array_uintersect_assoc</function> and + <function>array_uintersect_uassoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-udiff.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/array/functions/array-udiff.xml diff -u phpdoc/en/reference/array/functions/array-udiff.xml:1.10 phpdoc/en/reference/array/functions/array-udiff.xml:1.11 --- phpdoc/en/reference/array/functions/array-udiff.xml:1.10 Mon Apr 25 08:13:48 2005 +++ phpdoc/en/reference/array/functions/array-udiff.xml Tue Oct 31 11:24:01 2006 @@ -1,46 +1,46 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> - <refentry id="function.array-udiff"> - <refnamediv> - <refname>array_udiff</refname> - <refpurpose>Computes the difference of arrays by using a callback function for data comparison</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_udiff</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_udiff</function> returns an array - containing all the values of <parameter>array1</parameter> - that are not present in any of the other arguments. - Note that keys are preserved. For the comparison of the data - <parameter>data_compare_func</parameter> is used. - It must return an integer less than, equal - to, or greater than zero if the first argument is considered to - be respectively less than, equal to, or greater than the - second. This is unlike <function>array_diff</function> which uses an - internal function for comparing the data. - </para> - <para> - <example> - <title><function>array_udiff</function> example</title> - <programlisting role="php"> +<refentry id="function.array-udiff"> + <refnamediv> + <refname>array_udiff</refname> + <refpurpose>Computes the difference of arrays by using a callback function for data comparison</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_udiff</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_udiff</function> returns an array + containing all the values of <parameter>array1</parameter> + that are not present in any of the other arguments. + Note that keys are preserved. For the comparison of the data + <parameter>data_compare_func</parameter> is used. + It must return an integer less than, equal + to, or greater than zero if the first argument is considered to + be respectively less than, equal to, or greater than the + second. This is unlike <function>array_diff</function> which uses an + internal function for comparing the data. + </para> + <para> + <example> + <title><function>array_udiff</function> example</title> + <programlisting role="php"> <![CDATA[ <?php class cr { private $priv_member; - function cr($val) + function cr($val) { $this->priv_member = $val; } - - function comp_func_cr($a, $b) + + function comp_func_cr($a, $b) { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; @@ -53,9 +53,9 @@ print_r($result); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -71,31 +71,31 @@ ) ]]> - </screen> - </example> - </para> - <note> - <simpara> - Please note that this function only checks one dimension of a n-dimensional - array. Of course you can check deeper dimensions by using - <literal>array_udiff($array1[0], $array2[0], "data_compare_func");</literal>. - </simpara> - </note> - <para> - See also - <function>array_diff</function>, - <function>array_diff_assoc</function>, - <function>array_diff_uassoc</function>, - <function>array_udiff_assoc</function>, - <function>array_udiff_uassoc</function>, - <function>array_intersect</function>, - <function>array_intersect_assoc</function>, - <function>array_uintersect</function>, - <function>array_uintersect_assoc</function> and - <function>array_uintersect_uassoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <note> + <simpara> + Please note that this function only checks one dimension of a n-dimensional + array. Of course you can check deeper dimensions by using + <literal>array_udiff($array1[0], $array2[0], "data_compare_func");</literal>. + </simpara> + </note> + <para> + See also + <function>array_diff</function>, + <function>array_diff_assoc</function>, + <function>array_diff_uassoc</function>, + <function>array_udiff_assoc</function>, + <function>array_udiff_uassoc</function>, + <function>array_intersect</function>, + <function>array_intersect_assoc</function>, + <function>array_uintersect</function>, + <function>array_uintersect_assoc</function> and + <function>array_uintersect_uassoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-uintersect-assoc.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/array/functions/array-uintersect-assoc.xml diff -u phpdoc/en/reference/array/functions/array-uintersect-assoc.xml:1.4 phpdoc/en/reference/array/functions/array-uintersect-assoc.xml:1.5 --- phpdoc/en/reference/array/functions/array-uintersect-assoc.xml:1.4 Mon Nov 1 12:39:25 2004 +++ phpdoc/en/reference/array/functions/array-uintersect-assoc.xml Tue Oct 31 11:24:01 2006 @@ -1,30 +1,30 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> - <refentry id="function.array-uintersect-assoc"> - <refnamediv> - <refname>array_uintersect_assoc</refname> - <refpurpose>Computes the intersection of arrays with additional index check, compares data by a callback function</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_uintersect_assoc</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_uintersect_assoc</function> returns an array - containing all the values of <parameter>array1</parameter> - that are present in all the arguments. Note that the keys are used in - the comparison unlike in <function>array_uintersect</function>. - The data is compared by using a callback function. - </para> - <para> - <example> - <title><function>array_uintersect_assoc</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.5 $ --> +<refentry id="function.array-uintersect-assoc"> + <refnamediv> + <refname>array_uintersect_assoc</refname> + <refpurpose>Computes the intersection of arrays with additional index check, compares data by a callback function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_uintersect_assoc</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_uintersect_assoc</function> returns an array + containing all the values of <parameter>array1</parameter> + that are present in all the arguments. Note that the keys are used in + the comparison unlike in <function>array_uintersect</function>. + The data is compared by using a callback function. + </para> + <para> + <example> + <title><function>array_uintersect_assoc</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); @@ -33,33 +33,33 @@ print_r(array_uintersect_assoc($array1, $array2, "strcasecmp")); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( [a] => green ) ]]> - </screen> - </example> - </para> - <para> - For comparison is used the user supplied callback function. - It must return an integer less than, equal - to, or greater than zero if the first argument is considered to - be respectively less than, equal to, or greater than the - second. - </para> - <para> - See also <function>array_uintersect</function>, - <function>array_intersect_assoc</function>, - <function>array_intersect_uassoc</function> and - <function>array_uintersect_uassoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + For comparison is used the user supplied callback function. + It must return an integer less than, equal + to, or greater than zero if the first argument is considered to + be respectively less than, equal to, or greater than the + second. + </para> + <para> + See also <function>array_uintersect</function>, + <function>array_intersect_assoc</function>, + <function>array_intersect_uassoc</function> and + <function>array_uintersect_uassoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-uintersect-uassoc.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/array/functions/array-uintersect-uassoc.xml diff -u phpdoc/en/reference/array/functions/array-uintersect-uassoc.xml:1.4 phpdoc/en/reference/array/functions/array-uintersect-uassoc.xml:1.5 --- phpdoc/en/reference/array/functions/array-uintersect-uassoc.xml:1.4 Mon Nov 1 12:39:25 2004 +++ phpdoc/en/reference/array/functions/array-uintersect-uassoc.xml Tue Oct 31 11:24:01 2006 @@ -1,31 +1,31 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> - <refentry id="function.array-uintersect-uassoc"> - <refnamediv> - <refname>array_uintersect_uassoc</refname> - <refpurpose>Computes the intersection of arrays with additional index check, compares data and indexes by a callback functions</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_uintersect_uassoc</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> - <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_uintersect_uassoc</function> returns an array - containing all the values of <parameter>array1</parameter> - that are present in all the arguments. Note that the keys are used in - the comparison unlike in <function>array_uintersect</function>. - Both the data and the indexes are compared by using a callback functions. - </para> - <para> - <example> - <title><function>array_uintersect_uassoc</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.5 $ --> +<refentry id="function.array-uintersect-uassoc"> + <refnamediv> + <refname>array_uintersect_uassoc</refname> + <refpurpose>Computes the intersection of arrays with additional index check, compares data and indexes by a callback functions</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_uintersect_uassoc</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> + <methodparam><type>callback</type><parameter>key_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_uintersect_uassoc</function> returns an array + containing all the values of <parameter>array1</parameter> + that are present in all the arguments. Note that the keys are used in + the comparison unlike in <function>array_uintersect</function>. + Both the data and the indexes are compared by using a callback functions. + </para> + <para> + <example> + <title><function>array_uintersect_uassoc</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); @@ -34,9 +34,9 @@ print_r(array_uintersect_uassoc($array1, $array2, "strcasecmp", "strcasecmp")); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -44,24 +44,24 @@ [b] => brown ) ]]> - </screen> - </example> - </para> - <para> - For comparison is used the user supplied callback function. - It must return an integer less than, equal - to, or greater than zero if the first argument is considered to - be respectively less than, equal to, or greater than the - second. - </para> - <para> - See also <function>array_uintersect</function>, - <function>array_intersect_assoc</function>, - <function>array_intersect_uassoc</function> and - <function>array_uintersect_assoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + For comparison is used the user supplied callback function. + It must return an integer less than, equal + to, or greater than zero if the first argument is considered to + be respectively less than, equal to, or greater than the + second. + </para> + <para> + See also <function>array_uintersect</function>, + <function>array_intersect_assoc</function>, + <function>array_intersect_uassoc</function> and + <function>array_uintersect_assoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-uintersect.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/array/functions/array-uintersect.xml diff -u phpdoc/en/reference/array/functions/array-uintersect.xml:1.4 phpdoc/en/reference/array/functions/array-uintersect.xml:1.5 --- phpdoc/en/reference/array/functions/array-uintersect.xml:1.4 Mon Nov 1 12:39:26 2004 +++ phpdoc/en/reference/array/functions/array-uintersect.xml Tue Oct 31 11:24:01 2006 @@ -1,29 +1,29 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> - <refentry id="function.array-uintersect"> - <refnamediv> - <refname>array_uintersect</refname> - <refpurpose>Computes the intersection of arrays, compares data by a callback function</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_uintersect</methodname> - <methodparam><type>array</type><parameter>array1</parameter></methodparam> - <methodparam><type>array</type><parameter>array2</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> - <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_uintersect</function> returns an array - containing all the values of <parameter>array1</parameter> - that are present in all the arguments. - The data is compared by using a callback function. - </para> - <para> - <example> - <title><function>array_uintersect</function> example</title> - <programlisting role="php"> +<!-- $Revision: 1.5 $ --> +<refentry id="function.array-uintersect"> + <refnamediv> + <refname>array_uintersect</refname> + <refpurpose>Computes the intersection of arrays, compares data by a callback function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_uintersect</methodname> + <methodparam><type>array</type><parameter>array1</parameter></methodparam> + <methodparam><type>array</type><parameter>array2</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam> + <methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_uintersect</function> returns an array + containing all the values of <parameter>array1</parameter> + that are present in all the arguments. + The data is compared by using a callback function. + </para> + <para> + <example> + <title><function>array_uintersect</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); @@ -32,9 +32,9 @@ print_r(array_uintersect($array1, $array2, "strcasecmp")); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -43,24 +43,24 @@ [0] => red ) ]]> - </screen> - </example> - </para> - <para> - For comparison is used the user supplied callback function. - It must return an integer less than, equal - to, or greater than zero if the first argument is considered to - be respectively less than, equal to, or greater than the - second. - </para> - <para> - See also <function>array_intersect</function>, - <function>array_uintersect_assoc</function>, - <function>array_intersect_uassoc</function> and - <function>array_uintersect_uassoc</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + For comparison is used the user supplied callback function. + It must return an integer less than, equal + to, or greater than zero if the first argument is considered to + be respectively less than, equal to, or greater than the + second. + </para> + <para> + See also <function>array_intersect</function>, + <function>array_uintersect_assoc</function>, + <function>array_intersect_uassoc</function> and + <function>array_uintersect_uassoc</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-unique.xml?r1=1.14&r2=1.15&diff_format=u Index: phpdoc/en/reference/array/functions/array-unique.xml diff -u phpdoc/en/reference/array/functions/array-unique.xml:1.14 phpdoc/en/reference/array/functions/array-unique.xml:1.15 --- phpdoc/en/reference/array/functions/array-unique.xml:1.14 Mon Nov 1 12:39:26 2004 +++ phpdoc/en/reference/array/functions/array-unique.xml Tue Oct 31 11:24:01 2006 @@ -1,43 +1,43 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-unique"> - <refnamediv> - <refname>array_unique</refname> - <refpurpose>Removes duplicate values from an array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_unique</methodname> - <methodparam><type>array</type><parameter>array</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_unique</function> takes input - <parameter>array</parameter> and returns a new array - without duplicate values. - </para> - <para> - Note that keys are preserved. <function>array_unique</function> sorts - the values treated as string at first, then will keep the first key - encountered for every value, and ignore all following keys. It does not - mean that the key of the first related value from the unsorted - <parameter>array</parameter> will be kept. - </para> - <note> - <simpara> - Two elements are considered equal if and only if - <literal>(string) $elem1 === (string) $elem2</literal>. In words: - when the string representation is the same. - </simpara> - <simpara> - The first element will be used. - </simpara> - </note> - <para> - <example> - <title><function>array_unique</function> example</title> - <programlisting role="php"> +<refentry id="function.array-unique"> + <refnamediv> + <refname>array_unique</refname> + <refpurpose>Removes duplicate values from an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_unique</methodname> + <methodparam><type>array</type><parameter>array</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_unique</function> takes input + <parameter>array</parameter> and returns a new array + without duplicate values. + </para> + <para> + Note that keys are preserved. <function>array_unique</function> sorts + the values treated as string at first, then will keep the first key + encountered for every value, and ignore all following keys. It does not + mean that the key of the first related value from the unsorted + <parameter>array</parameter> will be kept. + </para> + <note> + <simpara> + Two elements are considered equal if and only if + <literal>(string) $elem1 === (string) $elem2</literal>. In words: + when the string representation is the same. + </simpara> + <simpara> + The first element will be used. + </simpara> + </note> + <para> + <example> + <title><function>array_unique</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $input = array("a" => "green", "red", "b" => "green", "blue", "red"); @@ -45,9 +45,9 @@ print_r($result); ?> ]]> - </programlisting> - &example.outputs; - <screen role="php"> + </programlisting> + &example.outputs; + <screen role="php"> <![CDATA[ Array ( @@ -56,13 +56,13 @@ [1] => blue ) ]]> - </screen> - </example> - </para> - <para> - <example> - <title><function>array_unique</function> and types</title> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + <example> + <title><function>array_unique</function> and types</title> + <programlisting role="php"> <![CDATA[ <?php $input = array(4, "4", "3", 4, 3, "3"); @@ -70,20 +70,20 @@ var_dump($result); ?> ]]> - </programlisting> - &example.outputs; - <screen role="php"> + </programlisting> + &example.outputs; + <screen role="php"> <![CDATA[ array(2) { [0] => int(4) [2] => string(1) "3" } ]]> - </screen> - </example> - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-unshift.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/array-unshift.xml diff -u phpdoc/en/reference/array/functions/array-unshift.xml:1.11 phpdoc/en/reference/array/functions/array-unshift.xml:1.12 --- phpdoc/en/reference/array/functions/array-unshift.xml:1.11 Wed Nov 10 08:30:20 2004 +++ phpdoc/en/reference/array/functions/array-unshift.xml Tue Oct 31 11:24:01 2006 @@ -1,48 +1,46 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-unshift"> - <refnamediv> - <refname>array_unshift</refname> - <refpurpose> - Prepend one or more elements to the beginning of an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>int</type><methodname>array_unshift</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam><type>mixed</type><parameter>var</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_unshift</function> prepends passed elements to - the front of the <parameter>array</parameter>. Note that the list - of elements is prepended as a whole, so that the prepended - elements stay in the same order. All numerical array keys will be - modified to start counting from zero while literal keys won't be touched. - </para> - <para> - Returns the new number of elements in the - <parameter>array</parameter>. - </para> - <para> - <example> - <title><function>array_unshift</function> example</title> - <programlisting role="php"> +<refentry id="function.array-unshift"> + <refnamediv> + <refname>array_unshift</refname> + <refpurpose>Prepend one or more elements to the beginning of an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>int</type><methodname>array_unshift</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam><type>mixed</type><parameter>var</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_unshift</function> prepends passed elements to + the front of the <parameter>array</parameter>. Note that the list + of elements is prepended as a whole, so that the prepended + elements stay in the same order. All numerical array keys will be + modified to start counting from zero while literal keys won't be touched. + </para> + <para> + Returns the new number of elements in the + <parameter>array</parameter>. + </para> + <para> + <example> + <title><function>array_unshift</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $queue = array("orange", "banana"); array_unshift($queue, "apple", "raspberry"); ?> ]]> - </programlisting> - <para> - This would result in <varname>$queue</varname> having the - following elements: - </para> - <screen role="php"> + </programlisting> + <para> + This would result in <varname>$queue</varname> having the + following elements: + </para> + <screen role="php"> <![CDATA[ Array ( @@ -52,16 +50,16 @@ [3] => banana ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_shift</function>, - <function>array_push</function>, and - <function>array_pop</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_shift</function>, + <function>array_push</function>, and + <function>array_pop</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-values.xml?r1=1.10&r2=1.11&diff_format=u Index: phpdoc/en/reference/array/functions/array-values.xml diff -u phpdoc/en/reference/array/functions/array-values.xml:1.10 phpdoc/en/reference/array/functions/array-values.xml:1.11 --- phpdoc/en/reference/array/functions/array-values.xml:1.10 Mon Nov 1 12:39:26 2004 +++ phpdoc/en/reference/array/functions/array-values.xml Tue Oct 31 11:24:01 2006 @@ -1,35 +1,35 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-values"> - <refnamediv> - <refname>array_values</refname> - <refpurpose>Return all the values of an array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array_values</methodname> - <methodparam><type>array</type><parameter>input</parameter></methodparam> - </methodsynopsis> - <para> - <function>array_values</function> returns all the values from the - <parameter>input</parameter> array and indexes numerically the - array. - </para> - <para> - <example> - <title><function>array_values</function> example</title> - <programlisting role="php"> +<refentry id="function.array-values"> + <refnamediv> + <refname>array_values</refname> + <refpurpose>Return all the values of an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array_values</methodname> + <methodparam><type>array</type><parameter>input</parameter></methodparam> + </methodsynopsis> + <para> + <function>array_values</function> returns all the values from the + <parameter>input</parameter> array and indexes numerically the + array. + </para> + <para> + <example> + <title><function>array_values</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array = array("size" => "XL", "color" => "gold"); print_r(array_values($array)); ?> ]]> - </programlisting> - &example.outputs; - <screen role="php"> + </programlisting> + &example.outputs; + <screen role="php"> <![CDATA[ Array ( @@ -37,14 +37,14 @@ [1] => gold ) ]]> - </screen> - </example> - </para> - <para> - See also <function>array_keys</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_keys</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-walk-recursive.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/array/functions/array-walk-recursive.xml diff -u phpdoc/en/reference/array/functions/array-walk-recursive.xml:1.8 phpdoc/en/reference/array/functions/array-walk-recursive.xml:1.9 --- phpdoc/en/reference/array/functions/array-walk-recursive.xml:1.8 Sat Feb 19 12:33:33 2005 +++ phpdoc/en/reference/array/functions/array-walk-recursive.xml Tue Oct 31 11:24:01 2006 @@ -1,11 +1,9 @@ <?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <refentry id="function.array-walk-recursive"> <refnamediv> <refname>array_walk_recursive</refname> - <refpurpose> - Apply a user function recursively to every member of an array - </refpurpose> + <refpurpose>Apply a user function recursively to every member of an array</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -31,9 +29,9 @@ <para> If <parameter>funcname</parameter> needs to be working with the actual values of the array, specify the first parameter of - <parameter>funcname</parameter> as a + <parameter>funcname</parameter> as a <link linkend="language.references">reference</link>. Then, - any changes made to those elements will be made in the + any changes made to those elements will be made in the original array itself. </para> </note> @@ -46,7 +44,7 @@ $sweet = array('a' => 'apple', 'b' => 'banana'); $fruits = array('sweet' => $sweet, 'sour' => 'lemon'); -function test_print($item, $key) +function test_print($item, $key) { echo "$key holds $item\n"; } @@ -95,4 +93,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 ---> \ No newline at end of file +--> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array-walk.xml?r1=1.25&r2=1.26&diff_format=u Index: phpdoc/en/reference/array/functions/array-walk.xml diff -u phpdoc/en/reference/array/functions/array-walk.xml:1.25 phpdoc/en/reference/array/functions/array-walk.xml:1.26 --- phpdoc/en/reference/array/functions/array-walk.xml:1.25 Thu Sep 8 08:39:45 2005 +++ phpdoc/en/reference/array/functions/array-walk.xml Tue Oct 31 11:24:01 2006 @@ -1,86 +1,84 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.25 $ --> +<!-- $Revision: 1.26 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.array-walk"> - <refnamediv> - <refname>array_walk</refname> - <refpurpose> - Apply a user function to every member of an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>array_walk</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam><type>callback</type><parameter>funcname</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>userdata</parameter></methodparam> - </methodsynopsis> - <simpara> - &return.success; - </simpara> - <simpara> - Applies the user-defined function <parameter>funcname</parameter> to each - element of the <parameter>array</parameter> array. Typically, - <parameter>funcname</parameter> takes on two parameters. - The <parameter>array</parameter> parameter's value being the first, and - the key/index second. If the optional <parameter>userdata</parameter> - parameter is supplied, it will be passed as the third parameter to - the callback <parameter>funcname</parameter>. - </simpara> - <simpara> - If function <parameter>funcname</parameter> requires more parameters than - given to it, an error of level <link linkend="errorfunc.constants"> - E_WARNING</link> will be generated each time <function>array_walk</function> - calls <parameter>funcname</parameter>. These warnings may be suppressed by - prepending the PHP error operator - <link linkend="language.operators.errorcontrol">@</link> to the - <function>array_walk</function> call, or by using - <function>error_reporting</function>. - </simpara> - <note> - <para> - If <parameter>funcname</parameter> needs to be working with the - actual values of the array, specify the first parameter of - <parameter>funcname</parameter> as a - <link linkend="language.references">reference</link>. Then, - any changes made to those elements will be made in the - original array itself. - </para> - </note> - <note> - <para> - Passing the key and userdata to <parameter>funcname</parameter> was - added in 4.0.0 - </para> - </note> - <para> - <function>array_walk</function> is not affected by the internal - array pointer of <parameter>array</parameter>. <function> - array_walk</function> will walk through the entire array - regardless of pointer position. - </para> - <para> - Users may not change the array itself from the callback - function. e.g. Add/delete elements, unset elements, etc. If - the array that <function>array_walk</function> is applied to - is changed, the behavior of this function is undefined, and - unpredictable. - </para> - <para> - <example> - <title><function>array_walk</function> example</title> - <programlisting role="php"> +<refentry id="function.array-walk"> + <refnamediv> + <refname>array_walk</refname> + <refpurpose>Apply a user function to every member of an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>array_walk</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam><type>callback</type><parameter>funcname</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>userdata</parameter></methodparam> + </methodsynopsis> + <simpara> + &return.success; + </simpara> + <simpara> + Applies the user-defined function <parameter>funcname</parameter> to each + element of the <parameter>array</parameter> array. Typically, + <parameter>funcname</parameter> takes on two parameters. + The <parameter>array</parameter> parameter's value being the first, and + the key/index second. If the optional <parameter>userdata</parameter> + parameter is supplied, it will be passed as the third parameter to + the callback <parameter>funcname</parameter>. + </simpara> + <simpara> + If function <parameter>funcname</parameter> requires more parameters than + given to it, an error of level <link linkend="errorfunc.constants"> + E_WARNING</link> will be generated each time <function>array_walk</function> + calls <parameter>funcname</parameter>. These warnings may be suppressed by + prepending the PHP error operator + <link linkend="language.operators.errorcontrol">@</link> to the + <function>array_walk</function> call, or by using + <function>error_reporting</function>. + </simpara> + <note> + <para> + If <parameter>funcname</parameter> needs to be working with the + actual values of the array, specify the first parameter of + <parameter>funcname</parameter> as a + <link linkend="language.references">reference</link>. Then, + any changes made to those elements will be made in the + original array itself. + </para> + </note> + <note> + <para> + Passing the key and userdata to <parameter>funcname</parameter> was + added in 4.0.0 + </para> + </note> + <para> + <function>array_walk</function> is not affected by the internal + array pointer of <parameter>array</parameter>. <function> + array_walk</function> will walk through the entire array + regardless of pointer position. + </para> + <para> + Users may not change the array itself from the callback + function. e.g. Add/delete elements, unset elements, etc. If + the array that <function>array_walk</function> is applied to + is changed, the behavior of this function is undefined, and + unpredictable. + </para> + <para> + <example> + <title><function>array_walk</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); -function test_alter(&$item1, $key, $prefix) +function test_alter(&$item1, $key, $prefix) { $item1 = "$prefix: $item1"; } -function test_print($item2, $key) +function test_print($item2, $key) { echo "$key. $item2<br />\n"; } @@ -94,9 +92,9 @@ array_walk($fruits, 'test_print'); ?> ]]> - </programlisting> - &example.outputs; - <screen role="php"> + </programlisting> + &example.outputs; + <screen role="php"> <![CDATA[ Before ...: d. lemon @@ -109,21 +107,21 @@ b. fruit: banana c. fruit: apple ]]> - </screen> - </example> - </para> - <simpara> - See also <function>array_walk_recursive</function>, - <function>create_function</function>, - <function>list</function>, - <link linkend="control-structures.foreach">foreach</link>, - <function>each</function>, - <function>call_user_func_array</function>, and - <function>array_map</function>, and - &seealso.callback;. - </simpara> - </refsect1> - </refentry> + </screen> + </example> + </para> + <simpara> + See also <function>array_walk_recursive</function>, + <function>create_function</function>, + <function>list</function>, + <link linkend="control-structures.foreach">foreach</link>, + <function>each</function>, + <function>call_user_func_array</function>, and + <function>array_map</function>, and + &seealso.callback;. + </simpara> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/array.xml?r1=1.13&r2=1.14&diff_format=u Index: phpdoc/en/reference/array/functions/array.xml diff -u phpdoc/en/reference/array/functions/array.xml:1.13 phpdoc/en/reference/array/functions/array.xml:1.14 --- phpdoc/en/reference/array/functions/array.xml:1.13 Mon Nov 1 12:39:26 2004 +++ phpdoc/en/reference/array/functions/array.xml Tue Oct 31 11:24:01 2006 @@ -1,53 +1,51 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.110 --> - <refentry id="function.array"> - <refnamediv> - <refname>array</refname> - <refpurpose> - Create an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>array</methodname> - <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> - </methodsynopsis> - <para> - Returns an array of the parameters. The parameters can be given - an index with the <literal>=&gt;</literal> operator. Read the section - on the <link linkend="language.types.array">array type</link> for more - information on what an array is. - </para> - <para> - <note> - <para> - <function>array</function> is a language construct used to - represent literal arrays, and not a regular function. - </para> - </note> - </para> - <para> - Syntax "index =&gt; values", separated by commas, define index - and values. index may be of type string or numeric. When index is - omitted, an integer index is automatically generated, starting - at 0. If index is an integer, next generated index will - be the biggest integer index + 1. Note that when two identical - index are defined, the last overwrite the first. - </para> - <para> - Having a trailing comma after the last defined array entry, while - unusual, is a valid syntax. - </para> - <para> - The following example demonstrates how to create a - two-dimensional array, how to specify keys for associative - arrays, and how to skip-and-continue numeric indices in normal - arrays. - <example> - <title><function>array</function> example</title> - <programlisting role="php"> +<refentry id="function.array"> + <refnamediv> + <refname>array</refname> + <refpurpose>Create an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>array</methodname> + <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <para> + Returns an array of the parameters. The parameters can be given + an index with the <literal>=&gt;</literal> operator. Read the section + on the <link linkend="language.types.array">array type</link> for more + information on what an array is. + </para> + <para> + <note> + <para> + <function>array</function> is a language construct used to + represent literal arrays, and not a regular function. + </para> + </note> + </para> + <para> + Syntax "index =&gt; values", separated by commas, define index + and values. index may be of type string or numeric. When index is + omitted, an integer index is automatically generated, starting + at 0. If index is an integer, next generated index will + be the biggest integer index + 1. Note that when two identical + index are defined, the last overwrite the first. + </para> + <para> + Having a trailing comma after the last defined array entry, while + unusual, is a valid syntax. + </para> + <para> + The following example demonstrates how to create a + two-dimensional array, how to specify keys for associative + arrays, and how to skip-and-continue numeric indices in normal + arrays. + <example> + <title><function>array</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $fruits = array ( @@ -57,22 +55,22 @@ ); ?> ]]> - </programlisting> - </example> - </para> - <para> - <example> - <title>Automatic index with <function>array</function></title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + <example> + <title>Automatic index with <function>array</function></title> + <programlisting role="php"> <![CDATA[ <?php $array = array(1, 1, 1, 1, 1, 8 => 1, 4 => 1, 19, 3 => 13); print_r($array); ?> ]]> - </programlisting> - &example.outputs; - <screen role="php"> + </programlisting> + &example.outputs; + <screen role="php"> <![CDATA[ Array ( @@ -85,28 +83,28 @@ [9] => 19 ) ]]> - </screen> - </example> - </para> - <para> - Note that index '3' is defined twice, and keep its final value of 13. - Index 4 is defined after index 8, and next generated index (value 19) - is 9, since biggest index was 8. - </para> - <para> - This example creates a 1-based array. - <example> - <title>1-based index with <function>array</function></title> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + Note that index '3' is defined twice, and keep its final value of 13. + Index 4 is defined after index 8, and next generated index (value 19) + is 9, since biggest index was 8. + </para> + <para> + This example creates a 1-based array. + <example> + <title>1-based index with <function>array</function></title> + <programlisting role="php"> <![CDATA[ <?php $firstquarter = array(1 => 'January', 'February', 'March'); print_r($firstquarter); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Array ( @@ -115,15 +113,15 @@ [3] => March ) ]]> - </screen> - </example> - </para> - <para> - As in Perl, you can access a value from the array inside double quotes. - However, with PHP you'll need to enclose your array between curly braces. - <example> - <title>Accessing an array inside double quotes</title> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + As in Perl, you can access a value from the array inside double quotes. + However, with PHP you'll need to enclose your array between curly braces. + <example> + <title>Accessing an array inside double quotes</title> + <programlisting role="php"> <![CDATA[ <?php @@ -132,18 +130,18 @@ ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>array_pad</function>, - <function>list</function>, - <function>count</function>, - <link linkend="control-structures.foreach">foreach</link>, and - <function>range</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>array_pad</function>, + <function>list</function>, + <function>count</function>, + <link linkend="control-structures.foreach">foreach</link>, and + <function>range</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/arsort.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/en/reference/array/functions/arsort.xml diff -u phpdoc/en/reference/array/functions/arsort.xml:1.12 phpdoc/en/reference/array/functions/arsort.xml:1.13 --- phpdoc/en/reference/array/functions/arsort.xml:1.12 Fri Jul 1 13:07:46 2005 +++ phpdoc/en/reference/array/functions/arsort.xml Tue Oct 31 11:24:01 2006 @@ -1,32 +1,30 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.arsort"> - <refnamediv> - <refname>arsort</refname> - <refpurpose> - Sort an array in reverse order and maintain index association - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>arsort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> - </methodsynopsis> - <para> - This function sorts an array such that array indices maintain - their correlation with the array elements they are associated - with. This is used mainly when sorting associative arrays where - the actual element order is significant. - </para> - <para> - &return.success; - </para> - <example> - <title><function>arsort</function> example</title> - <programlisting role="php"> +<refentry id="function.arsort"> + <refnamediv> + <refname>arsort</refname> + <refpurpose>Sort an array in reverse order and maintain index association</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>arsort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> + </methodsynopsis> + <para> + This function sorts an array such that array indices maintain + their correlation with the array elements they are associated + with. This is used mainly when sorting associative arrays where + the actual element order is significant. + </para> + <para> + &return.success; + </para> + <example> + <title><function>arsort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); @@ -36,32 +34,32 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ a = orange d = lemon b = banana c = apple ]]> - </screen> - </example> - <para> - The fruits have been sorted in reverse alphabetical order, and - the index associated with each element has been maintained. - </para> - <para> - You may modify the behavior of the sort using the optional - parameter <parameter>sort_flags</parameter>, for details - see <function>sort</function>. - </para> - <para> - See also <function>asort</function>, <function>rsort</function>, - <function>ksort</function>, and <function>sort</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + <para> + The fruits have been sorted in reverse alphabetical order, and + the index associated with each element has been maintained. + </para> + <para> + You may modify the behavior of the sort using the optional + parameter <parameter>sort_flags</parameter>, for details + see <function>sort</function>. + </para> + <para> + See also <function>asort</function>, <function>rsort</function>, + <function>ksort</function>, and <function>sort</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/asort.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/en/reference/array/functions/asort.xml diff -u phpdoc/en/reference/array/functions/asort.xml:1.12 phpdoc/en/reference/array/functions/asort.xml:1.13 --- phpdoc/en/reference/array/functions/asort.xml:1.12 Fri Jul 1 13:07:46 2005 +++ phpdoc/en/reference/array/functions/asort.xml Tue Oct 31 11:24:01 2006 @@ -1,30 +1,30 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.asort"> - <refnamediv> - <refname>asort</refname> - <refpurpose>Sort an array and maintain index association</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>asort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> - </methodsynopsis> - <para> - This function sorts an array such that array indices maintain - their correlation with the array elements they are associated - with. This is used mainly when sorting associative arrays where - the actual element order is significant. - </para> - <para> - &return.success; - </para> - <example> - <title><function>asort</function> example</title> - <programlisting role="php"> +<refentry id="function.asort"> + <refnamediv> + <refname>asort</refname> + <refpurpose>Sort an array and maintain index association</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>asort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> + </methodsynopsis> + <para> + This function sorts an array such that array indices maintain + their correlation with the array elements they are associated + with. This is used mainly when sorting associative arrays where + the actual element order is significant. + </para> + <para> + &return.success; + </para> + <example> + <title><function>asort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); @@ -34,32 +34,32 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ c = apple b = banana d = lemon a = orange ]]> - </screen> - </example> - <para> - The fruits have been sorted in alphabetical order, and the index - associated with each element has been maintained. - </para> - <para> - You may modify the behavior of the sort using the optional - parameter <parameter>sort_flags</parameter>, for details - see <function>sort</function>. - </para> - <para> - See also <function>arsort</function>, <function>rsort</function>, - <function>ksort</function>, and <function>sort</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + <para> + The fruits have been sorted in alphabetical order, and the index + associated with each element has been maintained. + </para> + <para> + You may modify the behavior of the sort using the optional + parameter <parameter>sort_flags</parameter>, for details + see <function>sort</function>. + </para> + <para> + See also <function>arsort</function>, <function>rsort</function>, + <function>ksort</function>, and <function>sort</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/compact.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/array/functions/compact.xml diff -u phpdoc/en/reference/array/functions/compact.xml:1.8 phpdoc/en/reference/array/functions/compact.xml:1.9 --- phpdoc/en/reference/array/functions/compact.xml:1.8 Tue Jan 18 03:03:14 2005 +++ phpdoc/en/reference/array/functions/compact.xml Tue Oct 31 11:24:01 2006 @@ -1,52 +1,50 @@ <?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.compact"> - <refnamediv> - <refname>compact</refname> - <refpurpose> - Create array containing variables and their values - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>compact</methodname> - <methodparam><type>mixed</type><parameter>varname</parameter></methodparam> - <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> - </methodsynopsis> - <para> - <function>compact</function> takes a variable number of - parameters. Each parameter can be either a string containing the - name of the variable, or an array of variable names. The array - can contain other arrays of variable names inside it; - <function>compact</function> handles it recursively. - </para> - <para> - For each of these, <function>compact</function> looks for a - variable with that name in the current symbol table and adds it - to the output array such that the variable name becomes the key - and the contents of the variable become the value for that key. - In short, it does the opposite of <function>extract</function>. - It returns the output array with all the variables added to it. - </para> - <para> - Any strings that are not set will simply be skipped. - </para> - <note> - <title>Gotcha</title> - <para> - Because <link linkend="language.variables.variable">variable - variables</link> may not be used with PHP's - <link linkend="language.variables.superglobals">Superglobal - arrays</link> within functions, the Superglobal arrays may not be passed - into <function>compact</function>. - </para> - </note> - <para> - <example> - <title><function>compact</function> example</title> - <programlisting role="php"> +<refentry id="function.compact"> + <refnamediv> + <refname>compact</refname> + <refpurpose>Create array containing variables and their values</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>compact</methodname> + <methodparam><type>mixed</type><parameter>varname</parameter></methodparam> + <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <para> + <function>compact</function> takes a variable number of + parameters. Each parameter can be either a string containing the + name of the variable, or an array of variable names. The array + can contain other arrays of variable names inside it; + <function>compact</function> handles it recursively. + </para> + <para> + For each of these, <function>compact</function> looks for a + variable with that name in the current symbol table and adds it + to the output array such that the variable name becomes the key + and the contents of the variable become the value for that key. + In short, it does the opposite of <function>extract</function>. + It returns the output array with all the variables added to it. + </para> + <para> + Any strings that are not set will simply be skipped. + </para> + <note> + <title>Gotcha</title> + <para> + Because <link linkend="language.variables.variable">variable + variables</link> may not be used with PHP's + <link linkend="language.variables.superglobals">Superglobal + arrays</link> within functions, the Superglobal arrays may not be passed + into <function>compact</function>. + </para> + </note> + <para> + <example> + <title><function>compact</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $city = "San Francisco"; @@ -58,11 +56,11 @@ $result = compact("event", "nothing_here", $location_vars); ?> ]]> - </programlisting> - <para> - After this, <varname>$result</varname> will be: - </para> - <screen role="php"> + </programlisting> + <para> + After this, <varname>$result</varname> will be: + </para> + <screen role="php"> <![CDATA[ Array ( @@ -71,14 +69,14 @@ [state] => CA ) ]]> - </screen> - </example> - </para> - <para> - See also <function>extract</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>extract</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/count.xml?r1=1.17&r2=1.18&diff_format=u Index: phpdoc/en/reference/array/functions/count.xml diff -u phpdoc/en/reference/array/functions/count.xml:1.17 phpdoc/en/reference/array/functions/count.xml:1.18 --- phpdoc/en/reference/array/functions/count.xml:1.17 Mon Mar 21 09:47:52 2005 +++ phpdoc/en/reference/array/functions/count.xml Tue Oct 31 11:24:01 2006 @@ -1,69 +1,69 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.17 $ --> +<!-- $Revision: 1.18 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.count"> - <refnamediv> - <refname>count</refname> - <refpurpose>Count elements in an array, or properties in an object</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>int</type><methodname>count</methodname> - <methodparam><type>mixed</type><parameter>var</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>mode</parameter></methodparam> - </methodsynopsis> - <para> - Returns the number of elements in <parameter>var</parameter>, - which is typically an <type>array</type>, since anything else - will have one element. - </para> - <para> - For objects, if you have - <link linkend="ref.spl">SPL</link> installed, you can hook into - <function>count</function> by implementing interface - <literal>Countable</literal>. The interface has exactly one method, - <function>count</function>, which returns the return value for the - <function>count</function> function. - </para> - <para> - If <parameter>var</parameter> is not an array or an object with - implemented <literal>Countable</literal> interface, - <literal>1</literal> will be returned. - There is one exception, if <parameter>var</parameter> is &null;, - <literal>0</literal> will be returned. - </para> - <note> - <simpara> - The optional <parameter>mode</parameter> parameter is available as of - PHP 4.2.0. - </simpara> - </note> - <para> - If the optional <parameter>mode</parameter> parameter is set to - <constant>COUNT_RECURSIVE</constant> (or 1), <function>count</function> - will recursively count the array. This is particularly useful for - counting all the elements of a multidimensional array. The default - value for <parameter>mode</parameter> is <literal>0</literal>. - <function>count</function> does not detect infinite recursion. - </para> - <caution> - <para> - <function>count</function> may return 0 for a variable that - isn't set, but it may also return 0 for a variable that has - been initialized with an empty array. Use - <function>isset</function> to test if a variable is set. - </para> - </caution> - <para> - Please see the <link linkend="language.types.array">Array</link> - section of the manual for a detailed explanation of how arrays - are implemented and used in PHP. - </para> - <para> - <example> - <title><function>count</function> example</title> - <programlisting role="php"> +<refentry id="function.count"> + <refnamediv> + <refname>count</refname> + <refpurpose>Count elements in an array, or properties in an object</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>int</type><methodname>count</methodname> + <methodparam><type>mixed</type><parameter>var</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>mode</parameter></methodparam> + </methodsynopsis> + <para> + Returns the number of elements in <parameter>var</parameter>, + which is typically an <type>array</type>, since anything else + will have one element. + </para> + <para> + For objects, if you have + <link linkend="ref.spl">SPL</link> installed, you can hook into + <function>count</function> by implementing interface + <literal>Countable</literal>. The interface has exactly one method, + <function>count</function>, which returns the return value for the + <function>count</function> function. + </para> + <para> + If <parameter>var</parameter> is not an array or an object with + implemented <literal>Countable</literal> interface, + <literal>1</literal> will be returned. + There is one exception, if <parameter>var</parameter> is &null;, + <literal>0</literal> will be returned. + </para> + <note> + <simpara> + The optional <parameter>mode</parameter> parameter is available as of + PHP 4.2.0. + </simpara> + </note> + <para> + If the optional <parameter>mode</parameter> parameter is set to + <constant>COUNT_RECURSIVE</constant> (or 1), <function>count</function> + will recursively count the array. This is particularly useful for + counting all the elements of a multidimensional array. The default + value for <parameter>mode</parameter> is <literal>0</literal>. + <function>count</function> does not detect infinite recursion. + </para> + <caution> + <para> + <function>count</function> may return 0 for a variable that + isn't set, but it may also return 0 for a variable that has + been initialized with an empty array. Use + <function>isset</function> to test if a variable is set. + </para> + </caution> + <para> + Please see the <link linkend="language.types.array">Array</link> + section of the manual for a detailed explanation of how arrays + are implemented and used in PHP. + </para> + <para> + <example> + <title><function>count</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $a[0] = 1; @@ -85,15 +85,15 @@ // $result == 1 ?> ]]> - </programlisting> - </example> - </para> - <para> - <example> - <title> - Recursive <function>count</function> example (PHP &gt;= 4.2.0) - </title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + <example> + <title> + Recursive <function>count</function> example (PHP &gt;= 4.2.0) + </title> + <programlisting role="php"> <![CDATA[ <?php $food = array('fruits' => array('orange', 'banana', 'apple'), @@ -107,16 +107,16 @@ ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>is_array</function>, - <function>isset</function>, and - <function>strlen</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>is_array</function>, + <function>isset</function>, and + <function>strlen</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/current.xml?r1=1.11&r2=1.12&diff_format=u Index: phpdoc/en/reference/array/functions/current.xml diff -u phpdoc/en/reference/array/functions/current.xml:1.11 phpdoc/en/reference/array/functions/current.xml:1.12 --- phpdoc/en/reference/array/functions/current.xml:1.11 Mon May 29 16:03:18 2006 +++ phpdoc/en/reference/array/functions/current.xml Tue Oct 31 11:24:01 2006 @@ -1,44 +1,44 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.11 $ --> +<!-- $Revision: 1.12 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.current"> - <refnamediv> - <refname>current</refname> - <refpurpose>Return the current element in an array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>current</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - Every array has an internal pointer to its "current" element, - which is initialized to the first element inserted into the - array. - </para> - <para> - The <function>current</function> function simply returns the - value of the array element that's currently being pointed to by the - internal pointer. It does not move the pointer in any way. If the - internal pointer points beyond the end of the elements list, - <function>current</function> returns &false;. - </para> - - &return.falseproblem; - - <note> - <simpara> - You won't be able to distinguish the end of an array from a - <type>boolean</type> &false; element. To properly traverse an array - which may contain &false; elements, see the <function>each</function> - function. - </simpara> - </note> - <para> - <example> - <title>Example use of <function>current</function> and friends</title> - <programlisting role="php"> +<refentry id="function.current"> + <refnamediv> + <refname>current</refname> + <refpurpose>Return the current element in an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>current</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + Every array has an internal pointer to its "current" element, + which is initialized to the first element inserted into the + array. + </para> + <para> + The <function>current</function> function simply returns the + value of the array element that's currently being pointed to by the + internal pointer. It does not move the pointer in any way. If the + internal pointer points beyond the end of the elements list, + <function>current</function> returns &false;. + </para> + + &return.falseproblem; + + <note> + <simpara> + You won't be able to distinguish the end of an array from a + <type>boolean</type> &false; element. To properly traverse an array + which may contain &false; elements, see the <function>each</function> + function. + </simpara> + </note> + <para> + <example> + <title>Example use of <function>current</function> and friends</title> + <programlisting role="php"> <![CDATA[ <?php $transport = array('foot', 'bike', 'car', 'plane'); @@ -50,16 +50,16 @@ $mode = current($transport); // $mode = 'plane'; ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>end</function>, <function>key</function>, - <function>next</function>, <function>prev</function>, - <function>reset</function>, and <function>each</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>end</function>, <function>key</function>, + <function>next</function>, <function>prev</function>, + <function>reset</function>, and <function>each</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/each.xml?r1=1.17&r2=1.18&diff_format=u Index: phpdoc/en/reference/array/functions/each.xml diff -u phpdoc/en/reference/array/functions/each.xml:1.17 phpdoc/en/reference/array/functions/each.xml:1.18 --- phpdoc/en/reference/array/functions/each.xml:1.17 Wed Nov 10 08:30:20 2004 +++ phpdoc/en/reference/array/functions/each.xml Tue Oct 31 11:24:01 2006 @@ -1,40 +1,37 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.17 $ --> +<!-- $Revision: 1.18 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.each"> - <refnamediv> - <refname>each</refname> - <refpurpose> - Return the current key and value pair from an array and advance - the array cursor - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>each</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - Returns the current key and value pair from the array - <parameter>array</parameter> and advances the array cursor. This - pair is returned in a four-element array, with the keys - <literal>0</literal>, <literal>1</literal>, - <literal>key</literal>, and - <literal>value</literal>. Elements <literal>0</literal> and - <literal>key</literal> contain the key name of the array - element, and <literal>1</literal> and - <literal>value</literal> contain the data. - </para> - <para> - If the internal pointer for the array points past the end of the - array contents, <function>each</function> returns - &false;. - </para> - <para> - <example> - <title><function>each</function> examples</title> - <programlisting role="php"> +<refentry id="function.each"> + <refnamediv> + <refname>each</refname> + <refpurpose>Return the current key and value pair from an array and advance the array cursor</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>each</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + Returns the current key and value pair from the array + <parameter>array</parameter> and advances the array cursor. This + pair is returned in a four-element array, with the keys + <literal>0</literal>, <literal>1</literal>, + <literal>key</literal>, and + <literal>value</literal>. Elements <literal>0</literal> and + <literal>key</literal> contain the key name of the array + element, and <literal>1</literal> and + <literal>value</literal> contain the data. + </para> + <para> + If the internal pointer for the array points past the end of the + array contents, <function>each</function> returns + &false;. + </para> + <para> + <example> + <title><function>each</function> examples</title> + <programlisting role="php"> <![CDATA[ <?php $foo = array("bob", "fred", "jussi", "jouni", "egon", "marliese"); @@ -42,12 +39,12 @@ print_r($bar); ?> ]]> - </programlisting> - <para> - <varname>$bar</varname> now contains the following key/value - pairs: - </para> - <screen> + </programlisting> + <para> + <varname>$bar</varname> now contains the following key/value + pairs: + </para> + <screen> <![CDATA[ Array ( @@ -57,12 +54,12 @@ [key] => 0 ) ]]> - </screen> - </example> - </para> - <para> - <informalexample> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + <informalexample> + <programlisting role="php"> <![CDATA[ <?php $foo = array("Robert" => "Bob", "Seppo" => "Sepi"); @@ -70,12 +67,12 @@ print_r($bar); ?> ]]> - </programlisting> - <para> - <varname>$bar</varname> now contains the following key/value - pairs: - </para> - <screen> + </programlisting> + <para> + <varname>$bar</varname> now contains the following key/value + pairs: + </para> + <screen> <![CDATA[ Array ( @@ -85,16 +82,16 @@ [key] => Robert ) ]]> - </screen> - </informalexample> - </para> - <para> - <function>each</function> is typically used in conjunction with - <function>list</function> to traverse an array, here's an - example: - <example> - <title>Traversing an array with <function>each</function></title> - <programlisting role="php"> + </screen> + </informalexample> + </para> + <para> + <function>each</function> is typically used in conjunction with + <function>list</function> to traverse an array, here's an + example: + <example> + <title>Traversing an array with <function>each</function></title> + <programlisting role="php"> <![CDATA[ <?php $fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry'); @@ -105,40 +102,40 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ a => apple b => banana c => cranberry ]]> - </screen> - </example> - </para> - <para> - After <function>each</function> has executed, the array cursor - will be left on the next element of the array, or past the last - element if it hits the end of the array. You have to use - <function>reset</function> if you want to traverse the array - again using each. - </para> - <caution> - <para> - Because assigning an array to another variable resets the original - arrays pointer, our example above would cause an endless loop had we - assigned <varname>$fruit</varname> to another variable inside the - loop. - </para> - </caution> - <para> - See also <function>key</function>, <function>list</function>, - <function>current</function>, <function>reset</function>, - <function>next</function>, <function>prev</function>, and - <link linkend="control-structures.foreach">foreach</link>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + After <function>each</function> has executed, the array cursor + will be left on the next element of the array, or past the last + element if it hits the end of the array. You have to use + <function>reset</function> if you want to traverse the array + again using each. + </para> + <caution> + <para> + Because assigning an array to another variable resets the original + arrays pointer, our example above would cause an endless loop had we + assigned <varname>$fruit</varname> to another variable inside the + loop. + </para> + </caution> + <para> + See also <function>key</function>, <function>list</function>, + <function>current</function>, <function>reset</function>, + <function>next</function>, <function>prev</function>, and + <link linkend="control-structures.foreach">foreach</link>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/end.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/en/reference/array/functions/end.xml diff -u phpdoc/en/reference/array/functions/end.xml:1.12 phpdoc/en/reference/array/functions/end.xml:1.13 --- phpdoc/en/reference/array/functions/end.xml:1.12 Wed Nov 10 08:30:20 2004 +++ phpdoc/en/reference/array/functions/end.xml Tue Oct 31 11:24:01 2006 @@ -1,47 +1,45 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.end"> - <refnamediv> - <refname>end</refname> - <refpurpose> - Set the internal pointer of an array to its last element - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>end</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - <function>end</function> advances <parameter>array</parameter>'s - internal pointer to the last element, and returns its value. - </para> - <para> - <example> - <title>A simple <function>end</function> example</title> - <programlisting role="php"> +<refentry id="function.end"> + <refnamediv> + <refname>end</refname> + <refpurpose>Set the internal pointer of an array to its last element</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>end</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + <function>end</function> advances <parameter>array</parameter>'s + internal pointer to the last element, and returns its value. + </para> + <para> + <example> + <title>A simple <function>end</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $fruits = array('apple', 'banana', 'cranberry'); echo end($fruits); // cranberry - + ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>current</function>, - <function>each</function>, - <function>prev</function>, - <function>next</function> and - <function>reset</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>current</function>, + <function>each</function>, + <function>prev</function>, + <function>next</function> and + <function>reset</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/extract.xml?r1=1.20&r2=1.21&diff_format=u Index: phpdoc/en/reference/array/functions/extract.xml diff -u phpdoc/en/reference/array/functions/extract.xml:1.20 phpdoc/en/reference/array/functions/extract.xml:1.21 --- phpdoc/en/reference/array/functions/extract.xml:1.20 Fri Sep 16 19:43:49 2005 +++ phpdoc/en/reference/array/functions/extract.xml Tue Oct 31 11:24:01 2006 @@ -1,176 +1,174 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.20 $ --> +<!-- $Revision: 1.21 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.extract"> - <refnamediv> - <refname>extract</refname> - <refpurpose> - Import variables into the current symbol table from an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>int</type><methodname>extract</methodname> - <methodparam><type>array</type><parameter>var_array</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>extract_type</parameter></methodparam> - <methodparam choice="opt"><type>string</type><parameter>prefix</parameter></methodparam> - </methodsynopsis> - <para> - This function is used to import variables from an array into the - current symbol table. It takes an associative array - <parameter>var_array</parameter> and treats keys as variable - names and values as variable values. For each key/value pair it - will create a variable in the current symbol table, subject to - <parameter>extract_type</parameter> and - <parameter>prefix</parameter> parameters. - </para> - <note> - <para> - Beginning with version 4.0.5, this function returns the number of - variables extracted. - </para> - </note> - <note> - <para> - <constant>EXTR_IF_EXISTS</constant> and <constant>EXTR_PREFIX_IF_EXISTS</constant> were introduced in version 4.2.0. - </para> - </note> - <note> - <para> - <constant>EXTR_REFS</constant> was introduced in version 4.3.0. - </para> - </note> - <para> - <function>extract</function> checks each key to see whether it - has a valid variable name. It also checks for collisions with - existing variables in the symbol table. The way invalid/numeric - keys and collisions are treated is determined by the - <parameter>extract_type</parameter>. It can be one of the - following values: - <variablelist> - <varlistentry> - <term><constant>EXTR_OVERWRITE</constant></term> - <listitem> - <simpara> - If there is a collision, overwrite the existing variable. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><constant>EXTR_SKIP</constant></term> - <listitem> - <simpara> - If there is a collision, don't overwrite the existing - variable. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><constant>EXTR_PREFIX_SAME</constant></term> - <listitem> - <simpara>If there is a collision, prefix the variable name with - <parameter>prefix</parameter>. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><constant>EXTR_PREFIX_ALL</constant></term> - <listitem> - <simpara> - Prefix all variable names with - <parameter>prefix</parameter>. Beginning with PHP 4.0.5, this includes - numeric variables as well. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><constant>EXTR_PREFIX_INVALID</constant></term> - <listitem> - <simpara> - Only prefix invalid/numeric variable names with - <parameter>prefix</parameter>. This flag was added in - PHP 4.0.5. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><constant>EXTR_IF_EXISTS</constant></term> - <listitem> - <simpara> - Only overwrite the variable if it already exists in the - current symbol table, otherwise do nothing. This is useful - for defining a list of valid variables and then extracting - only those variables you have defined out of $_REQUEST, for - example. This flag was added in PHP 4.2.0. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><constant>EXTR_PREFIX_IF_EXISTS</constant></term> - <listitem> - <simpara> - Only create prefixed variable names if the non-prefixed version - of the same variable exists in the current symbol table. This - flag was added in PHP 4.2.0. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><constant>EXTR_REFS</constant></term> - <listitem> - <simpara> - Extracts variables as references. This effectively means that the - values of the imported variables are still referencing the values of - the <parameter>var_array</parameter> parameter. You can use this flag - on its own or combine it with any other flag by OR'ing the - <parameter>extract_type</parameter>. This flag was added in PHP - 4.3.0. - </simpara> - </listitem> - </varlistentry> - </variablelist> - </para> - <para> - If <parameter>extract_type</parameter> is not specified, it is - assumed to be <constant>EXTR_OVERWRITE</constant>. - </para> - <para> - Note that <parameter>prefix</parameter> is only required if - <parameter>extract_type</parameter> is <constant>EXTR_PREFIX_SAME</constant>, - <constant>EXTR_PREFIX_ALL</constant>, <constant>EXTR_PREFIX_INVALID</constant> - or <constant>EXTR_PREFIX_IF_EXISTS</constant>. If - the prefixed result is not a valid variable name, it is not - imported into the symbol table. Prefixes are automatically separated from - the array key by an underscore character. - </para> - <para> - <function>extract</function> returns the number of variables - successfully imported into the symbol table. - </para> - <warning> - <para> - Do not use <function>extract</function> on untrusted data, like - user-input ($_GET, ...). If you do, for example, if you want to run old - code that relies on - <link linkend="security.globals">register_globals</link> - temporarily, make sure you use one of the non-overwriting - <parameter>extract_type</parameter> values such as - <constant>EXTR_SKIP</constant> and be aware that you should extract - in the same order that's defined in - <link linkend="ini.variables-order">variables_order</link> within the - <link linkend="ini">&php.ini;</link>. - </para> - </warning> - <para> - A possible use for <function>extract</function> is to import into the - symbol table variables contained in an associative array returned by - <function>wddx_deserialize</function>. - </para> - <para> - <example> - <title><function>extract</function> example</title> - <programlisting role="php"> +<refentry id="function.extract"> + <refnamediv> + <refname>extract</refname> + <refpurpose>Import variables into the current symbol table from an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>int</type><methodname>extract</methodname> + <methodparam><type>array</type><parameter>var_array</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>extract_type</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>prefix</parameter></methodparam> + </methodsynopsis> + <para> + This function is used to import variables from an array into the + current symbol table. It takes an associative array + <parameter>var_array</parameter> and treats keys as variable + names and values as variable values. For each key/value pair it + will create a variable in the current symbol table, subject to + <parameter>extract_type</parameter> and + <parameter>prefix</parameter> parameters. + </para> + <note> + <para> + Beginning with version 4.0.5, this function returns the number of + variables extracted. + </para> + </note> + <note> + <para> + <constant>EXTR_IF_EXISTS</constant> and <constant>EXTR_PREFIX_IF_EXISTS</constant> were introduced in version 4.2.0. + </para> + </note> + <note> + <para> + <constant>EXTR_REFS</constant> was introduced in version 4.3.0. + </para> + </note> + <para> + <function>extract</function> checks each key to see whether it + has a valid variable name. It also checks for collisions with + existing variables in the symbol table. The way invalid/numeric + keys and collisions are treated is determined by the + <parameter>extract_type</parameter>. It can be one of the + following values: + <variablelist> + <varlistentry> + <term><constant>EXTR_OVERWRITE</constant></term> + <listitem> + <simpara> + If there is a collision, overwrite the existing variable. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><constant>EXTR_SKIP</constant></term> + <listitem> + <simpara> + If there is a collision, don't overwrite the existing + variable. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><constant>EXTR_PREFIX_SAME</constant></term> + <listitem> + <simpara>If there is a collision, prefix the variable name with + <parameter>prefix</parameter>. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><constant>EXTR_PREFIX_ALL</constant></term> + <listitem> + <simpara> + Prefix all variable names with + <parameter>prefix</parameter>. Beginning with PHP 4.0.5, this includes + numeric variables as well. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><constant>EXTR_PREFIX_INVALID</constant></term> + <listitem> + <simpara> + Only prefix invalid/numeric variable names with + <parameter>prefix</parameter>. This flag was added in + PHP 4.0.5. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><constant>EXTR_IF_EXISTS</constant></term> + <listitem> + <simpara> + Only overwrite the variable if it already exists in the + current symbol table, otherwise do nothing. This is useful + for defining a list of valid variables and then extracting + only those variables you have defined out of $_REQUEST, for + example. This flag was added in PHP 4.2.0. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><constant>EXTR_PREFIX_IF_EXISTS</constant></term> + <listitem> + <simpara> + Only create prefixed variable names if the non-prefixed version + of the same variable exists in the current symbol table. This + flag was added in PHP 4.2.0. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><constant>EXTR_REFS</constant></term> + <listitem> + <simpara> + Extracts variables as references. This effectively means that the + values of the imported variables are still referencing the values of + the <parameter>var_array</parameter> parameter. You can use this flag + on its own or combine it with any other flag by OR'ing the + <parameter>extract_type</parameter>. This flag was added in PHP + 4.3.0. + </simpara> + </listitem> + </varlistentry> + </variablelist> + </para> + <para> + If <parameter>extract_type</parameter> is not specified, it is + assumed to be <constant>EXTR_OVERWRITE</constant>. + </para> + <para> + Note that <parameter>prefix</parameter> is only required if + <parameter>extract_type</parameter> is <constant>EXTR_PREFIX_SAME</constant>, + <constant>EXTR_PREFIX_ALL</constant>, <constant>EXTR_PREFIX_INVALID</constant> + or <constant>EXTR_PREFIX_IF_EXISTS</constant>. If + the prefixed result is not a valid variable name, it is not + imported into the symbol table. Prefixes are automatically separated from + the array key by an underscore character. + </para> + <para> + <function>extract</function> returns the number of variables + successfully imported into the symbol table. + </para> + <warning> + <para> + Do not use <function>extract</function> on untrusted data, like + user-input ($_GET, ...). If you do, for example, if you want to run old + code that relies on + <link linkend="security.globals">register_globals</link> + temporarily, make sure you use one of the non-overwriting + <parameter>extract_type</parameter> values such as + <constant>EXTR_SKIP</constant> and be aware that you should extract + in the same order that's defined in + <link linkend="ini.variables-order">variables_order</link> within the + <link linkend="ini">&php.ini;</link>. + </para> + </warning> + <para> + A possible use for <function>extract</function> is to import into the + symbol table variables contained in an associative array returned by + <function>wddx_deserialize</function>. + </para> + <para> + <example> + <title><function>extract</function> example</title> + <programlisting role="php"> <![CDATA[ <?php @@ -187,36 +185,36 @@ ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ blue, large, sphere, medium ]]> - </screen> - </example> - </para> - <para> - The <varname>$size</varname> wasn't overwritten, because we - specified <constant>EXTR_PREFIX_SAME</constant>, which resulted in - <varname>$wddx_size</varname> being created. If <constant>EXTR_SKIP</constant> was - specified, then $wddx_size wouldn't even have been created. - <constant>EXTR_OVERWRITE</constant> would have caused <varname>$size</varname> to have - value "medium", and <constant>EXTR_PREFIX_ALL</constant> would result in new variables - being named <varname>$wddx_color</varname>, - <varname>$wddx_size</varname>, and - <varname>$wddx_shape</varname>. - </para> - <para> - You must use an associative array, a numerically indexed array - will not produce results unless you use <constant>EXTR_PREFIX_ALL</constant> or - <constant>EXTR_PREFIX_INVALID</constant>. - </para> - <para> - See also <function>compact</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + The <varname>$size</varname> wasn't overwritten, because we + specified <constant>EXTR_PREFIX_SAME</constant>, which resulted in + <varname>$wddx_size</varname> being created. If <constant>EXTR_SKIP</constant> was + specified, then $wddx_size wouldn't even have been created. + <constant>EXTR_OVERWRITE</constant> would have caused <varname>$size</varname> to have + value "medium", and <constant>EXTR_PREFIX_ALL</constant> would result in new variables + being named <varname>$wddx_color</varname>, + <varname>$wddx_size</varname>, and + <varname>$wddx_shape</varname>. + </para> + <para> + You must use an associative array, a numerically indexed array + will not produce results unless you use <constant>EXTR_PREFIX_ALL</constant> or + <constant>EXTR_PREFIX_INVALID</constant>. + </para> + <para> + See also <function>compact</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/in-array.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/en/reference/array/functions/in-array.xml diff -u phpdoc/en/reference/array/functions/in-array.xml:1.12 phpdoc/en/reference/array/functions/in-array.xml:1.13 --- phpdoc/en/reference/array/functions/in-array.xml:1.12 Mon Nov 1 12:39:27 2004 +++ phpdoc/en/reference/array/functions/in-array.xml Tue Oct 31 11:24:01 2006 @@ -1,46 +1,46 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.56 --> - <refentry id="function.in-array"> - <refnamediv> - <refname>in_array</refname> - <refpurpose>Checks if a value exists in an array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>in_array</methodname> - <methodparam><type>mixed</type><parameter>needle</parameter></methodparam> - <methodparam><type>array</type><parameter>haystack</parameter></methodparam> - <methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam> - </methodsynopsis> - <para> - Searches <parameter>haystack</parameter> for - <parameter>needle</parameter> and returns &true; - if it is found in the array, &false; otherwise. - </para> - <para> - If the third parameter <parameter>strict</parameter> is set to - &true; then the <function>in_array</function> function - will also check the <link linkend="language.types">types</link> of - the <parameter>needle</parameter> in the <parameter>haystack</parameter>. - </para> - <note> - <para> - If <parameter>needle</parameter> is a string, the comparison is done in - a case-sensitive manner. - </para> - </note> - <note> - <para> - In PHP versions before 4.2.0 <parameter>needle</parameter> was not - allowed to be an array. - </para> - </note> - <para> - <example> - <title><function>in_array</function> example</title> - <programlisting role="php"> +<refentry id="function.in-array"> + <refnamediv> + <refname>in_array</refname> + <refpurpose>Checks if a value exists in an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>in_array</methodname> + <methodparam><type>mixed</type><parameter>needle</parameter></methodparam> + <methodparam><type>array</type><parameter>haystack</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam> + </methodsynopsis> + <para> + Searches <parameter>haystack</parameter> for + <parameter>needle</parameter> and returns &true; + if it is found in the array, &false; otherwise. + </para> + <para> + If the third parameter <parameter>strict</parameter> is set to + &true; then the <function>in_array</function> function + will also check the <link linkend="language.types">types</link> of + the <parameter>needle</parameter> in the <parameter>haystack</parameter>. + </para> + <note> + <para> + If <parameter>needle</parameter> is a string, the comparison is done in + a case-sensitive manner. + </para> + </note> + <note> + <para> + In PHP versions before 4.2.0 <parameter>needle</parameter> was not + allowed to be an array. + </para> + </note> + <para> + <example> + <title><function>in_array</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $os = array("Mac", "NT", "Irix", "Linux"); @@ -52,22 +52,22 @@ } ?> ]]> - </programlisting> - <para> - The second condition fails because <function>in_array</function> - is case-sensitive, so the program above will display: - </para> - <screen> + </programlisting> + <para> + The second condition fails because <function>in_array</function> + is case-sensitive, so the program above will display: + </para> + <screen> <![CDATA[ Got Irix ]]> - </screen> - </example> - </para> - <para> - <example> - <title><function>in_array</function> with strict example</title> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + <example> + <title><function>in_array</function> with strict example</title> + <programlisting role="php"> <![CDATA[ <?php $a = array('1.10', 12.4, 1.13); @@ -81,19 +81,19 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ 1.13 found with strict check ]]> - </screen> - </example> - </para> - <para> - <example> - <title><function>in_array</function> with an array as needle</title> - <programlisting role="php"> + </screen> + </example> + </para> + <para> + <example> + <title><function>in_array</function> with an array as needle</title> + <programlisting role="php"> <![CDATA[ <?php $a = array(array('p', 'h'), array('p', 'r'), 'o'); @@ -111,23 +111,23 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ 'ph' was found 'o' was found ]]> - </screen> - </example> - </para> - <para> - See also <function>array_search</function>, - <function>array_key_exists</function>, and - <function>isset</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>array_search</function>, + <function>array_key_exists</function>, and + <function>isset</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/key.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/key.xml diff -u phpdoc/en/reference/array/functions/key.xml:1.9 phpdoc/en/reference/array/functions/key.xml:1.10 --- phpdoc/en/reference/array/functions/key.xml:1.9 Wed Nov 10 08:30:21 2004 +++ phpdoc/en/reference/array/functions/key.xml Tue Oct 31 11:24:01 2006 @@ -1,25 +1,25 @@ <?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.key"> - <refnamediv> - <refname>key</refname> - <refpurpose>Fetch a key from an associative array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>key</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - <function>key</function> returns the index element of the - current array position. - </para> - <para> - <example> - <title><function>key</function> example</title> - <programlisting role="php"> +<refentry id="function.key"> + <refnamediv> + <refname>key</refname> + <refpurpose>Fetch a key from an associative array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>key</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + <function>key</function> returns the index element of the + current array position. + </para> + <para> + <example> + <title><function>key</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array = array( @@ -39,14 +39,14 @@ } ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>current</function> and <function>next</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>current</function> and <function>next</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/krsort.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/en/reference/array/functions/krsort.xml diff -u phpdoc/en/reference/array/functions/krsort.xml:1.12 phpdoc/en/reference/array/functions/krsort.xml:1.13 --- phpdoc/en/reference/array/functions/krsort.xml:1.12 Fri Jul 1 13:07:46 2005 +++ phpdoc/en/reference/array/functions/krsort.xml Tue Oct 31 11:24:01 2006 @@ -1,29 +1,29 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.krsort"> - <refnamediv> - <refname>krsort</refname> - <refpurpose>Sort an array by key in reverse order</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>krsort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> - </methodsynopsis> - <para> - Sorts an array by key in reverse order, maintaining key to data - correlations. This is useful mainly for associative arrays. - </para> - <para> - &return.success; - </para> - <para> - <example> - <title><function>krsort</function> example</title> - <programlisting role="php"> +<refentry id="function.krsort"> + <refnamediv> + <refname>krsort</refname> + <refpurpose>Sort an array by key in reverse order</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>krsort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> + </methodsynopsis> + <para> + Sorts an array by key in reverse order, maintaining key to data + correlations. This is useful mainly for associative arrays. + </para> + <para> + &return.success; + </para> + <para> + <example> + <title><function>krsort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); @@ -33,30 +33,30 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ d = lemon c = apple b = banana a = orange ]]> - </screen> - </example> - </para> - <para> - You may modify the behavior of the sort using the optional - parameter <parameter>sort_flags</parameter>, for details - see <function>sort</function>. - </para> - <simpara> - See also <function>asort</function>, <function>arsort</function>, - <function>ksort</function>, <function>sort</function>, - <function>natsort</function>, and <function>rsort</function>. - </simpara> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + You may modify the behavior of the sort using the optional + parameter <parameter>sort_flags</parameter>, for details + see <function>sort</function>. + </para> + <simpara> + See also <function>asort</function>, <function>arsort</function>, + <function>ksort</function>, <function>sort</function>, + <function>natsort</function>, and <function>rsort</function>. + </simpara> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/ksort.xml?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/en/reference/array/functions/ksort.xml diff -u phpdoc/en/reference/array/functions/ksort.xml:1.12 phpdoc/en/reference/array/functions/ksort.xml:1.13 --- phpdoc/en/reference/array/functions/ksort.xml:1.12 Fri Jul 1 13:07:46 2005 +++ phpdoc/en/reference/array/functions/ksort.xml Tue Oct 31 11:24:01 2006 @@ -1,29 +1,29 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.ksort"> - <refnamediv> - <refname>ksort</refname> - <refpurpose>Sort an array by key</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>ksort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> - </methodsynopsis> - <para> - Sorts an array by key, maintaining key to data correlations. This - is useful mainly for associative arrays. - </para> - <para> - &return.success; - </para> - <para> - <example> - <title><function>ksort</function> example</title> - <programlisting role="php"> +<refentry id="function.ksort"> + <refnamediv> + <refname>ksort</refname> + <refpurpose>Sort an array by key</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>ksort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> + </methodsynopsis> + <para> + Sorts an array by key, maintaining key to data correlations. This + is useful mainly for associative arrays. + </para> + <para> + &return.success; + </para> + <para> + <example> + <title><function>ksort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); @@ -33,36 +33,36 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ a = orange b = banana c = apple d = lemon ]]> - </screen> - </example> - </para> - <para> - You may modify the behavior of the sort using the optional - parameter <parameter>sort_flags</parameter>, for details - see <function>sort</function>. - </para> - <simpara> - See also <function>asort</function>, <function>arsort</function>, - <function>krsort</function>, <function>uksort</function>, - <function>sort</function>, <function>natsort</function>, and - <function>rsort</function>. - </simpara> - <note> - <para> - The second parameter was added in PHP 4. - </para> - </note> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + You may modify the behavior of the sort using the optional + parameter <parameter>sort_flags</parameter>, for details + see <function>sort</function>. + </para> + <simpara> + See also <function>asort</function>, <function>arsort</function>, + <function>krsort</function>, <function>uksort</function>, + <function>sort</function>, <function>natsort</function>, and + <function>rsort</function>. + </simpara> + <note> + <para> + The second parameter was added in PHP 4. + </para> + </note> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/list.xml?r1=1.14&r2=1.15&diff_format=u Index: phpdoc/en/reference/array/functions/list.xml diff -u phpdoc/en/reference/array/functions/list.xml:1.14 phpdoc/en/reference/array/functions/list.xml:1.15 --- phpdoc/en/reference/array/functions/list.xml:1.14 Wed Feb 9 09:19:13 2005 +++ phpdoc/en/reference/array/functions/list.xml Tue Oct 31 11:24:01 2006 @@ -1,35 +1,33 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.list"> - <refnamediv> - <refname>list</refname> - <refpurpose> - Assign variables as if they were an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>void</type><methodname>list</methodname> - <methodparam><type>mixed</type><parameter>varname</parameter></methodparam> - <methodparam rep="repeat"><type>mixed</type><parameter>...</parameter></methodparam> - </methodsynopsis> - <para> - Like <function>array</function>, this is not really a function, - but a language construct. <function>list</function> is used to - assign a list of variables in one operation. - </para> - <note> - <para> - <function>list</function> only works on numerical arrays and assumes - the numerical indices start at 0. - </para> - </note> - <para> - <example> - <title><function>list</function> examples</title> - <programlisting role="php"> +<refentry id="function.list"> + <refnamediv> + <refname>list</refname> + <refpurpose>Assign variables as if they were an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>void</type><methodname>list</methodname> + <methodparam><type>mixed</type><parameter>varname</parameter></methodparam> + <methodparam rep="repeat"><type>mixed</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <para> + Like <function>array</function>, this is not really a function, + but a language construct. <function>list</function> is used to + assign a list of variables in one operation. + </para> + <note> + <para> + <function>list</function> only works on numerical arrays and assumes + the numerical indices start at 0. + </para> + </note> + <para> + <example> + <title><function>list</function> examples</title> + <programlisting role="php"> <![CDATA[ <?php @@ -49,13 +47,13 @@ ?> ]]> - </programlisting> - </example> - </para> - <para> - <example> - <title>An example use of <function>list</function></title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + <example> + <title>An example use of <function>list</function></title> + <programlisting role="php"> <![CDATA[ <table> <tr> @@ -77,23 +75,23 @@ </table> ]]> - </programlisting> - </example> - </para> - <warning> - <para> - <function>list</function> assigns the values starting with the right-most - parameter. If you are using plain variables, you don't have to worry - about this. But if you are using arrays with indices you usually expect - the order of the indices in the array the same you wrote in the - <function>list</function> from left to right; which it isn't. It's - assigned in the reverse order. - </para> - </warning> - <para> - <example> - <title>Using <function>list</function> with array indices</title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <warning> + <para> + <function>list</function> assigns the values starting with the right-most + parameter. If you are using plain variables, you don't have to worry + about this. But if you are using arrays with indices you usually expect + the order of the indices in the array the same you wrote in the + <function>list</function> from left to right; which it isn't. It's + assigned in the reverse order. + </para> + </warning> + <para> + <example> + <title>Using <function>list</function> with array indices</title> + <programlisting role="php"> <![CDATA[ <?php @@ -105,12 +103,12 @@ ?> ]]> - </programlisting> - <para> - Gives the following output (note the order of the elements compared in - which order they were written in the <function>list</function> syntax): - </para> - <screen> + </programlisting> + <para> + Gives the following output (note the order of the elements compared in + which order they were written in the <function>list</function> syntax): + </para> + <screen> <![CDATA[ array(3) { [2]=> @@ -121,15 +119,15 @@ string(6) "coffee" } ]]> - </screen> - </example> - </para> - <para> - See also <function>each</function>, <function>array</function> - and <function>extract</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>each</function>, <function>array</function> + and <function>extract</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/natcasesort.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/natcasesort.xml diff -u phpdoc/en/reference/array/functions/natcasesort.xml:1.9 phpdoc/en/reference/array/functions/natcasesort.xml:1.10 --- phpdoc/en/reference/array/functions/natcasesort.xml:1.9 Mon Dec 6 11:22:17 2004 +++ phpdoc/en/reference/array/functions/natcasesort.xml Tue Oct 31 11:24:01 2006 @@ -1,35 +1,33 @@ <?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.25 --> - <refentry id="function.natcasesort"> - <refnamediv> - <refname>natcasesort</refname> - <refpurpose> - Sort an array using a case insensitive "natural order" algorithm - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>natcasesort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - This function implements a sort algorithm that orders - alphanumeric strings in the way a human being would while maintaining - key/value associations. This is described as a "natural ordering". - </para> - <para> - &return.success; - </para> - <para> - <function>natcasesort</function> is a case insensitive version of - <function>natsort</function>. - </para> - <para> - <example> - <title><function>natcasesort</function> example</title> - <programlisting role="php"> +<refentry id="function.natcasesort"> + <refnamediv> + <refname>natcasesort</refname> + <refpurpose>Sort an array using a case insensitive "natural order" algorithm</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>natcasesort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + This function implements a sort algorithm that orders + alphanumeric strings in the way a human being would while maintaining + key/value associations. This is described as a "natural ordering". + </para> + <para> + &return.success; + </para> + <para> + <function>natcasesort</function> is a case insensitive version of + <function>natsort</function>. + </para> + <para> + <example> + <title><function>natcasesort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = $array2 = array('IMG0.png', 'img12.png', 'img10.png', 'img2.png', 'img1.png', 'IMG3.png'); @@ -43,9 +41,9 @@ print_r($array2); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Standard sorting Array @@ -69,22 +67,22 @@ [1] => img12.png ) ]]> - </screen> - <para> - For more information see: Martin Pool's <ulink - url="&url.strnatcmp;">Natural Order String Comparison</ulink> - page. - </para> - </example> - </para> + </screen> <para> - See also <function>sort</function>, - <function>natsort</function>, - <function>strnatcmp</function>, and - <function>strnatcasecmp</function>. + For more information see: Martin Pool's <ulink + url="&url.strnatcmp;">Natural Order String Comparison</ulink> + page. </para> - </refsect1> - </refentry> + </example> + </para> + <para> + See also <function>sort</function>, + <function>natsort</function>, + <function>strnatcmp</function>, and + <function>strnatcasecmp</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/natsort.xml?r1=1.13&r2=1.14&diff_format=u Index: phpdoc/en/reference/array/functions/natsort.xml diff -u phpdoc/en/reference/array/functions/natsort.xml:1.13 phpdoc/en/reference/array/functions/natsort.xml:1.14 --- phpdoc/en/reference/array/functions/natsort.xml:1.13 Mon Dec 6 11:22:17 2004 +++ phpdoc/en/reference/array/functions/natsort.xml Tue Oct 31 11:24:01 2006 @@ -1,34 +1,32 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.25 --> - <refentry id="function.natsort"> - <refnamediv> - <refname>natsort</refname> - <refpurpose> - Sort an array using a "natural order" algorithm - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>natsort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - This function implements a sort algorithm that orders - alphanumeric strings in the way a human being would while maintaining - key/value associations. This is described as a "natural ordering". An - example of the difference between this algorithm and the regular computer - string sorting algorithms (used in <function>sort</function>) can be seen - below: - </para> - <para> - &return.success; - </para> - <para> - <example> - <title><function>natsort</function> example</title> - <programlisting role="php"> +<refentry id="function.natsort"> + <refnamediv> + <refname>natsort</refname> + <refpurpose>Sort an array using a "natural order" algorithm</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>natsort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + This function implements a sort algorithm that orders + alphanumeric strings in the way a human being would while maintaining + key/value associations. This is described as a "natural ordering". An + example of the difference between this algorithm and the regular computer + string sorting algorithms (used in <function>sort</function>) can be seen + below: + </para> + <para> + &return.success; + </para> + <para> + <example> + <title><function>natsort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array1 = $array2 = array("img12.png", "img10.png", "img2.png", "img1.png"); @@ -42,9 +40,9 @@ print_r($array2); ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ Standard sorting Array @@ -64,21 +62,21 @@ [0] => img12.png ) ]]> - </screen> - <para> - For more information see: Martin Pool's <ulink - url="&url.strnatcmp;">Natural Order String Comparison</ulink> - page. - </para> - </example> - </para> + </screen> <para> - See also <function>natcasesort</function>, - <function>strnatcmp</function>, and - <function>strnatcasecmp</function>. + For more information see: Martin Pool's <ulink + url="&url.strnatcmp;">Natural Order String Comparison</ulink> + page. </para> - </refsect1> - </refentry> + </example> + </para> + <para> + See also <function>natcasesort</function>, + <function>strnatcmp</function>, and + <function>strnatcasecmp</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/next.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/next.xml diff -u phpdoc/en/reference/array/functions/next.xml:1.9 phpdoc/en/reference/array/functions/next.xml:1.10 --- phpdoc/en/reference/array/functions/next.xml:1.9 Mon May 29 16:03:18 2006 +++ phpdoc/en/reference/array/functions/next.xml Tue Oct 31 11:24:01 2006 @@ -1,47 +1,45 @@ <?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.next"> - <refnamediv> - <refname>next</refname> - <refpurpose> - Advance the internal array pointer of an array - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>next</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - Returns the array value in the next place that's pointed to by the - internal array pointer, or &false; if there are no more elements. - </para> - <para> - <function>next</function> behaves like - <function>current</function>, with one difference. It advances - the internal array pointer one place forward before returning the - element value. That means it returns the next array value and - advances the internal array pointer by one. If advancing the - internal array pointer results in going beyond the end of the - element list, <function>next</function> returns &false;. - </para> - - &return.falseproblem; - - <note> - <simpara> - You won't be able to distinguish the end of an array from a - <type>boolean</type> &false; element. To properly traverse an array - which may contain &false; elements, see the <function>each</function> - function. - </simpara> - </note> - <para> - <example> - <title>Example use of <function>next</function> and friends</title> - <programlisting role="php"> +<refentry id="function.next"> + <refnamediv> + <refname>next</refname> + <refpurpose>Advance the internal array pointer of an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>next</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + Returns the array value in the next place that's pointed to by the + internal array pointer, or &false; if there are no more elements. + </para> + <para> + <function>next</function> behaves like + <function>current</function>, with one difference. It advances + the internal array pointer one place forward before returning the + element value. That means it returns the next array value and + advances the internal array pointer by one. If advancing the + internal array pointer results in going beyond the end of the + element list, <function>next</function> returns &false;. + </para> + + &return.falseproblem; + + <note> + <simpara> + You won't be able to distinguish the end of an array from a + <type>boolean</type> &false; element. To properly traverse an array + which may contain &false; elements, see the <function>each</function> + function. + </simpara> + </note> + <para> + <example> + <title>Example use of <function>next</function> and friends</title> + <programlisting role="php"> <![CDATA[ <?php $transport = array('foot', 'bike', 'car', 'plane'); @@ -52,17 +50,17 @@ $mode = end($transport); // $mode = 'plane'; ?> ]]> - </programlisting> - </example> - </para> - <para> - See also - <function>current</function>, <function>end</function>, - <function>prev</function>, <function>reset</function>, - and <function>each</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also + <function>current</function>, <function>end</function>, + <function>prev</function>, <function>reset</function>, + and <function>each</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/prev.xml?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/en/reference/array/functions/prev.xml diff -u phpdoc/en/reference/array/functions/prev.xml:1.9 phpdoc/en/reference/array/functions/prev.xml:1.10 --- phpdoc/en/reference/array/functions/prev.xml:1.9 Mon May 29 16:03:18 2006 +++ phpdoc/en/reference/array/functions/prev.xml Tue Oct 31 11:24:01 2006 @@ -1,42 +1,42 @@ <?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.prev"> - <refnamediv> - <refname>prev</refname> - <refpurpose>Rewind the internal array pointer</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>prev</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - Returns the array value in the previous place that's pointed to by - the internal array pointer, or &false; if there are no more - elements. - </para> - - &return.falseproblem; - - <note> - <simpara> - You won't be able to distinguish the beginning of an array from a - <type>boolean</type> &false; element. To properly traverse an array - which may contain &false; elements, see the <function>each</function> - function. - </simpara> - </note> - <para> - <function>prev</function> behaves just like - <function>next</function>, except it rewinds the internal array - pointer one place instead of advancing it. - </para> - <para> - <example> - <title>Example use of <function>prev</function> and friends</title> - <programlisting role="php"> +<refentry id="function.prev"> + <refnamediv> + <refname>prev</refname> + <refpurpose>Rewind the internal array pointer</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>prev</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + Returns the array value in the previous place that's pointed to by + the internal array pointer, or &false; if there are no more + elements. + </para> + + &return.falseproblem; + + <note> + <simpara> + You won't be able to distinguish the beginning of an array from a + <type>boolean</type> &false; element. To properly traverse an array + which may contain &false; elements, see the <function>each</function> + function. + </simpara> + </note> + <para> + <function>prev</function> behaves just like + <function>next</function>, except it rewinds the internal array + pointer one place instead of advancing it. + </para> + <para> + <example> + <title>Example use of <function>prev</function> and friends</title> + <programlisting role="php"> <![CDATA[ <?php $transport = array('foot', 'bike', 'car', 'plane'); @@ -47,16 +47,16 @@ $mode = end($transport); // $mode = 'plane'; ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>current</function>, <function>end</function>, - <function>next</function>, <function>reset</function>, - and <function>each</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>current</function>, <function>end</function>, + <function>next</function>, <function>reset</function>, + and <function>each</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/range.xml?r1=1.16&r2=1.17&diff_format=u Index: phpdoc/en/reference/array/functions/range.xml diff -u phpdoc/en/reference/array/functions/range.xml:1.16 phpdoc/en/reference/array/functions/range.xml:1.17 --- phpdoc/en/reference/array/functions/range.xml:1.16 Tue May 31 13:19:08 2005 +++ phpdoc/en/reference/array/functions/range.xml Tue Oct 31 11:24:01 2006 @@ -1,42 +1,40 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.range"> - <refnamediv> - <refname>range</refname> - <refpurpose> - Create an array containing a range of elements - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>range</methodname> - <methodparam><type>mixed</type><parameter>low</parameter></methodparam> - <methodparam><type>mixed</type><parameter>high</parameter></methodparam> - <methodparam choice="opt"><type>number</type><parameter>step</parameter></methodparam> - </methodsynopsis> - <para> - <function>range</function> returns an array of elements from - <parameter>low</parameter> to <parameter>high</parameter>, - inclusive. If low > high, the sequence will be from high to low. - </para> - <note> - <title>New parameter</title> - <simpara> - The optional <parameter>step</parameter> parameter was added in 5.0.0. - </simpara> - </note> - <para> - If a <parameter>step</parameter> value is given, it will be used as the - increment between elements in the sequence. <parameter>step</parameter> - should be given as a positive number. If not specified, - <parameter>step</parameter> will default to 1. - </para> - <para> - <example> - <title><function>range</function> examples</title> - <programlisting role="php"> +<refentry id="function.range"> + <refnamediv> + <refname>range</refname> + <refpurpose>Create an array containing a range of elements</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>array</type><methodname>range</methodname> + <methodparam><type>mixed</type><parameter>low</parameter></methodparam> + <methodparam><type>mixed</type><parameter>high</parameter></methodparam> + <methodparam choice="opt"><type>number</type><parameter>step</parameter></methodparam> + </methodsynopsis> + <para> + <function>range</function> returns an array of elements from + <parameter>low</parameter> to <parameter>high</parameter>, + inclusive. If low > high, the sequence will be from high to low. + </para> + <note> + <title>New parameter</title> + <simpara> + The optional <parameter>step</parameter> parameter was added in 5.0.0. + </simpara> + </note> + <para> + If a <parameter>step</parameter> value is given, it will be used as the + increment between elements in the sequence. <parameter>step</parameter> + should be given as a positive number. If not specified, + <parameter>step</parameter> will default to 1. + </para> + <para> + <example> + <title><function>range</function> examples</title> + <programlisting role="php"> <![CDATA[ <?php // array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) @@ -61,33 +59,33 @@ } ?> ]]> - </programlisting> - </example> - </para> - <note> - <para> - Prior to PHP 4.1.0, <function>range</function> only generated - incrementing integer arrays. Support for character sequences and - decrementing arrays was added in 4.1.0. Character sequence values - are limited to a length of one. If a length greater than one is - entered, only the first character is used. - </para> - </note> - <caution> - <para> - In PHP versions 4.1.0 through 4.3.2, <function>range</function> sees - numeric strings as strings and not integers. Instead, they will be - used for character sequences. For example, <literal>"4242"</literal> - is treated as <literal>"4"</literal>. - </para> - </caution> - <para> - See also <function>shuffle</function>, - <function>array_fill</function>, and - <link linkend="control-structures.foreach">foreach</link>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <note> + <para> + Prior to PHP 4.1.0, <function>range</function> only generated + incrementing integer arrays. Support for character sequences and + decrementing arrays was added in 4.1.0. Character sequence values + are limited to a length of one. If a length greater than one is + entered, only the first character is used. + </para> + </note> + <caution> + <para> + In PHP versions 4.1.0 through 4.3.2, <function>range</function> sees + numeric strings as strings and not integers. Instead, they will be + used for character sequences. For example, <literal>"4242"</literal> + is treated as <literal>"4"</literal>. + </para> + </caution> + <para> + See also <function>shuffle</function>, + <function>array_fill</function>, and + <link linkend="control-structures.foreach">foreach</link>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/reset.xml?r1=1.14&r2=1.15&diff_format=u Index: phpdoc/en/reference/array/functions/reset.xml diff -u phpdoc/en/reference/array/functions/reset.xml:1.14 phpdoc/en/reference/array/functions/reset.xml:1.15 --- phpdoc/en/reference/array/functions/reset.xml:1.14 Mon Nov 28 01:33:59 2005 +++ phpdoc/en/reference/array/functions/reset.xml Tue Oct 31 11:24:01 2006 @@ -1,57 +1,55 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.reset"> - <refnamediv> - <refname>reset</refname> - <refpurpose> - Set the internal pointer of an array to its first element - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>mixed</type><methodname>reset</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - <function>reset</function> rewinds <parameter>array</parameter>'s - internal pointer to the first element and returns the value of the first - array element, or &false; if the array is empty. - </para> - <para> - <example> - <title><function>reset</function> example</title> - <programlisting role="php"> +<refentry id="function.reset"> + <refnamediv> + <refname>reset</refname> + <refpurpose>Set the internal pointer of an array to its first element</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>mixed</type><methodname>reset</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + <function>reset</function> rewinds <parameter>array</parameter>'s + internal pointer to the first element and returns the value of the first + array element, or &false; if the array is empty. + </para> + <para> + <example> + <title><function>reset</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $array = array('step one', 'step two', 'step three', 'step four'); - -// by default, the pointer is on the first element + +// by default, the pointer is on the first element echo current($array) . "<br />\n"; // "step one" -// skip two steps -next($array); +// skip two steps +next($array); next($array); echo current($array) . "<br />\n"; // "step three" - + // reset pointer, start again on step one reset($array); echo current($array) . "<br />\n"; // "step one" - + ?> ]]> - </programlisting> - </example> - </para> - <para> - See also <function>current</function>, - <function>each</function>, <function>end</function>, - <function>next</function>, and <function>prev</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + See also <function>current</function>, + <function>each</function>, <function>end</function>, + <function>next</function>, and <function>prev</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/rsort.xml?r1=1.13&r2=1.14&diff_format=u Index: phpdoc/en/reference/array/functions/rsort.xml diff -u phpdoc/en/reference/array/functions/rsort.xml:1.13 phpdoc/en/reference/array/functions/rsort.xml:1.14 --- phpdoc/en/reference/array/functions/rsort.xml:1.13 Wed Aug 24 14:15:11 2005 +++ phpdoc/en/reference/array/functions/rsort.xml Tue Oct 31 11:24:02 2006 @@ -1,29 +1,29 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.rsort"> - <refnamediv> - <refname>rsort</refname> - <refpurpose>Sort an array in reverse order</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>rsort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> - </methodsynopsis> - <para> - This function sorts an array in reverse order (highest to lowest). - </para> - &note.no-key-association; - <para> - &return.success; - </para> - <para> - <example> - <title><function>rsort</function> example</title> - <programlisting role="php"> +<refentry id="function.rsort"> + <refnamediv> + <refname>rsort</refname> + <refpurpose>Sort an array in reverse order</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>rsort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> + </methodsynopsis> + <para> + This function sorts an array in reverse order (highest to lowest). + </para> + &note.no-key-association; + <para> + &return.success; + </para> + <para> + <example> + <title><function>rsort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $fruits = array("lemon", "orange", "banana", "apple"); @@ -33,34 +33,34 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ 0 = orange 1 = lemon 2 = banana 3 = apple ]]> - </screen> - </example> - </para> - <para> - The fruits have been sorted in reverse alphabetical order. - </para> - <para> - You may modify the behavior of the sort using the optional - parameter <parameter>sort_flags</parameter>, for details - see <function>sort</function>. - </para> - <para> - See also <function>arsort</function>, - <function>asort</function>, <function>ksort</function>, - <function>krsort</function>, - <function>sort</function>, and <function>usort</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + The fruits have been sorted in reverse alphabetical order. + </para> + <para> + You may modify the behavior of the sort using the optional + parameter <parameter>sort_flags</parameter>, for details + see <function>sort</function>. + </para> + <para> + See also <function>arsort</function>, + <function>asort</function>, <function>ksort</function>, + <function>krsort</function>, + <function>sort</function>, and <function>usort</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/shuffle.xml?r1=1.14&r2=1.15&diff_format=u Index: phpdoc/en/reference/array/functions/shuffle.xml diff -u phpdoc/en/reference/array/functions/shuffle.xml:1.14 phpdoc/en/reference/array/functions/shuffle.xml:1.15 --- phpdoc/en/reference/array/functions/shuffle.xml:1.14 Wed Aug 24 14:15:11 2005 +++ phpdoc/en/reference/array/functions/shuffle.xml Tue Oct 31 11:24:02 2006 @@ -1,26 +1,26 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.shuffle"> - <refnamediv> - <refname>shuffle</refname> - <refpurpose>Shuffle an array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>shuffle</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - </methodsynopsis> - <para> - This function shuffles (randomizes the order of the elements in) - an array. - </para> - &note.no-key-association; - <para> - <example> - <title><function>shuffle</function> example</title> - <programlisting role="php"> +<refentry id="function.shuffle"> + <refnamediv> + <refname>shuffle</refname> + <refpurpose>Shuffle an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>shuffle</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + </methodsynopsis> + <para> + This function shuffles (randomizes the order of the elements in) + an array. + </para> + &note.no-key-association; + <para> + <example> + <title><function>shuffle</function> example</title> + <programlisting role="php"> <![CDATA[ <?php $numbers = range(1, 20); @@ -31,19 +31,19 @@ } ?> ]]> - </programlisting> - </example> - </para> - - &note.randomseed; - - <para> - See also <function>arsort</function>, <function>asort</function>, - <function>ksort</function>, <function>rsort</function>, - <function>sort</function>, and <function>usort</function>. - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + + &note.randomseed; + + <para> + See also <function>arsort</function>, <function>asort</function>, + <function>ksort</function>, <function>rsort</function>, + <function>sort</function>, and <function>usort</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/sort.xml?r1=1.23&r2=1.24&diff_format=u Index: phpdoc/en/reference/array/functions/sort.xml diff -u phpdoc/en/reference/array/functions/sort.xml:1.23 phpdoc/en/reference/array/functions/sort.xml:1.24 --- phpdoc/en/reference/array/functions/sort.xml:1.23 Sun Sep 25 15:55:37 2005 +++ phpdoc/en/reference/array/functions/sort.xml Tue Oct 31 11:24:02 2006 @@ -1,30 +1,30 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.23 $ --> +<!-- $Revision: 1.24 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.sort"> - <refnamediv> - <refname>sort</refname> - <refpurpose>Sort an array</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>sort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> - </methodsynopsis> - <para> - This function sorts an array. Elements will be arranged from - lowest to highest when this function has completed. - </para> - &note.no-key-association; - <para> - &return.success; - </para> - <para> - <example> - <title><function>sort</function> example</title> - <programlisting role="php"> +<refentry id="function.sort"> + <refnamediv> + <refname>sort</refname> + <refpurpose>Sort an array</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>sort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> + </methodsynopsis> + <para> + This function sorts an array. Elements will be arranged from + lowest to highest when this function has completed. + </para> + &note.no-key-association; + <para> + &return.success; + </para> + <para> + <example> + <title><function>sort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php @@ -36,70 +36,70 @@ ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ fruits[0] = apple fruits[1] = banana fruits[2] = lemon fruits[3] = orange ]]> - </screen> - </example> - </para> - <para> - The fruits have been sorted in alphabetical order. - </para> - <para> - The optional second parameter <parameter>sort_flags</parameter> - may be used to modify the sorting behavior using these values: - </para> - <para> - Sorting type flags: - <itemizedlist> - <listitem> - <simpara><constant>SORT_REGULAR</constant> - compare items normally - (don't change types)</simpara> - </listitem> - <listitem> - <simpara><constant>SORT_NUMERIC</constant> - compare items numerically</simpara> - </listitem> - <listitem> - <simpara><constant>SORT_STRING</constant> - compare items as strings</simpara> - </listitem> - <listitem> - <simpara><constant>SORT_LOCALE_STRING</constant> - compare items as - strings, based on the current locale. Added in PHP 4.4.0 and 5.0.2. - Before PHP 6, it uses the system locale, which can be changed using - <function>setlocale</function>. Since PHP 6, you must use the - <function>i18n_loc_set_default</function> function. - </simpara> - </listitem> - </itemizedlist> - </para> - <note> - <para> - The second parameter was added in PHP 4. - </para> - </note> - <warning> - <simpara> - Be careful when sorting arrays with mixed types values because - <function>sort</function> can produce unpredictable results. + </screen> + </example> + </para> + <para> + The fruits have been sorted in alphabetical order. + </para> + <para> + The optional second parameter <parameter>sort_flags</parameter> + may be used to modify the sorting behavior using these values: + </para> + <para> + Sorting type flags: + <itemizedlist> + <listitem> + <simpara><constant>SORT_REGULAR</constant> - compare items normally + (don't change types)</simpara> + </listitem> + <listitem> + <simpara><constant>SORT_NUMERIC</constant> - compare items numerically</simpara> + </listitem> + <listitem> + <simpara><constant>SORT_STRING</constant> - compare items as strings</simpara> + </listitem> + <listitem> + <simpara><constant>SORT_LOCALE_STRING</constant> - compare items as + strings, based on the current locale. Added in PHP 4.4.0 and 5.0.2. + Before PHP 6, it uses the system locale, which can be changed using + <function>setlocale</function>. Since PHP 6, you must use the + <function>i18n_loc_set_default</function> function. </simpara> - </warning> - <para> - See also <function>arsort</function>, - <function>asort</function>, <function>ksort</function>, - <function>krsort</function>, - <function>natsort</function>, <function>natcasesort</function>, - <function>rsort</function>, <function>usort</function>, - <function>array_multisort</function>, and - <function>uksort</function>. - </para> - </refsect1> - </refentry> + </listitem> + </itemizedlist> + </para> + <note> + <para> + The second parameter was added in PHP 4. + </para> + </note> + <warning> + <simpara> + Be careful when sorting arrays with mixed types values because + <function>sort</function> can produce unpredictable results. + </simpara> + </warning> + <para> + See also <function>arsort</function>, + <function>asort</function>, <function>ksort</function>, + <function>krsort</function>, + <function>natsort</function>, <function>natcasesort</function>, + <function>rsort</function>, <function>usort</function>, + <function>array_multisort</function>, and + <function>uksort</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/uasort.xml?r1=1.8&r2=1.9&diff_format=u Index: phpdoc/en/reference/array/functions/uasort.xml diff -u phpdoc/en/reference/array/functions/uasort.xml:1.8 phpdoc/en/reference/array/functions/uasort.xml:1.9 --- phpdoc/en/reference/array/functions/uasort.xml:1.8 Wed Nov 10 08:30:22 2004 +++ phpdoc/en/reference/array/functions/uasort.xml Tue Oct 31 11:24:02 2006 @@ -1,46 +1,43 @@ <?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.uasort"> - <refnamediv> - <refname>uasort</refname> - <refpurpose> - Sort an array with a user-defined comparison function and - maintain index association - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>uasort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> - </methodsynopsis> - <para> - This function sorts an array such that array indices maintain - their correlation with the array elements they are associated - with. This is used mainly when sorting associative arrays where - the actual element order is significant. The comparison function - is user-defined. - </para> - <para> - &return.success; - </para> - <note> - <para> - Please see <function>usort</function> and - <function>uksort</function> for examples of user-defined - comparison functions. - </para> - </note> - <para> - See also <function>usort</function>, <function>uksort</function>, - <function>sort</function>, <function>asort</function>, - <function>arsort</function>, <function>ksort</function>, - and <function>rsort</function>. - </para> - </refsect1> - </refentry> +<refentry id="function.uasort"> + <refnamediv> + <refname>uasort</refname> + <refpurpose>Sort an array with a user-defined comparison function and maintain index association</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>uasort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> + </methodsynopsis> + <para> + This function sorts an array such that array indices maintain + their correlation with the array elements they are associated + with. This is used mainly when sorting associative arrays where + the actual element order is significant. The comparison function + is user-defined. + </para> + <para> + &return.success; + </para> + <note> + <para> + Please see <function>usort</function> and + <function>uksort</function> for examples of user-defined + comparison functions. + </para> + </note> + <para> + See also <function>usort</function>, <function>uksort</function>, + <function>sort</function>, <function>asort</function>, + <function>arsort</function>, <function>ksort</function>, + and <function>rsort</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/uksort.xml?r1=1.18&r2=1.19&diff_format=u Index: phpdoc/en/reference/array/functions/uksort.xml diff -u phpdoc/en/reference/array/functions/uksort.xml:1.18 phpdoc/en/reference/array/functions/uksort.xml:1.19 --- phpdoc/en/reference/array/functions/uksort.xml:1.18 Wed Apr 5 08:28:14 2006 +++ phpdoc/en/reference/array/functions/uksort.xml Tue Oct 31 11:24:02 2006 @@ -1,44 +1,42 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.18 $ --> +<!-- $Revision: 1.19 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.uksort"> - <refnamediv> - <refname>uksort</refname> - <refpurpose> - Sort an array by keys using a user-defined comparison function - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>uksort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> - </methodsynopsis> - <para> - <function>uksort</function> will sort the keys of an array using a - user-supplied comparison function. If the array you wish to sort - needs to be sorted by some non-trivial criteria, you should use - this function. - </para> - <para> - Function <parameter>cmp_function</parameter> should accept two - parameters which will be filled by pairs of <parameter>array</parameter> keys. - The comparison function must return an integer less than, equal - to, or greater than zero if the first argument is considered to - be respectively less than, equal to, or greater than the - second. - </para> - <para> - &return.success; - </para> - <para> - <example> - <title><function>uksort</function> example</title> - <programlisting role="php"> +<refentry id="function.uksort"> + <refnamediv> + <refname>uksort</refname> + <refpurpose>Sort an array by keys using a user-defined comparison function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>uksort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> + </methodsynopsis> + <para> + <function>uksort</function> will sort the keys of an array using a + user-supplied comparison function. If the array you wish to sort + needs to be sorted by some non-trivial criteria, you should use + this function. + </para> + <para> + Function <parameter>cmp_function</parameter> should accept two + parameters which will be filled by pairs of <parameter>array</parameter> keys. + The comparison function must return an integer less than, equal + to, or greater than zero if the first argument is considered to + be respectively less than, equal to, or greater than the + second. + </para> + <para> + &return.success; + </para> + <para> + <example> + <title><function>uksort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php -function cmp($a, $b) +function cmp($a, $b) { $a = ereg_replace('^(a|an|the) ', '', $a); $b = ereg_replace('^(a|an|the) ', '', $b); @@ -54,26 +52,26 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ an apple: 3 a banana: 4 the Earth: 2 John: 1 ]]> - </screen> - </example> - </para> - <para> - See also <function>usort</function>, <function>uasort</function>, - <function>sort</function>, <function>asort</function>, - <function>arsort</function>, <function>ksort</function>, - <function>natsort</function>, and <function>rsort</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + See also <function>usort</function>, <function>uasort</function>, + <function>sort</function>, <function>asort</function>, + <function>arsort</function>, <function>ksort</function>, + <function>natsort</function>, and <function>rsort</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/array/functions/usort.xml?r1=1.23&r2=1.24&diff_format=u Index: phpdoc/en/reference/array/functions/usort.xml diff -u phpdoc/en/reference/array/functions/usort.xml:1.23 phpdoc/en/reference/array/functions/usort.xml:1.24 --- phpdoc/en/reference/array/functions/usort.xml:1.23 Wed Aug 24 14:15:11 2005 +++ phpdoc/en/reference/array/functions/usort.xml Tue Oct 31 11:24:02 2006 @@ -1,53 +1,51 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.23 $ --> +<!-- $Revision: 1.24 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> - <refentry id="function.usort"> - <refnamediv> - <refname>usort</refname> - <refpurpose> - Sort an array by values using a user-defined comparison function - </refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>usort</methodname> - <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> - <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> - </methodsynopsis> - <para> - This function will sort an array by its values using a - user-supplied comparison function. If the array you wish to sort - needs to be sorted by some non-trivial criteria, you should use - this function. - </para> - <para> - The comparison function must return an integer less than, equal - to, or greater than zero if the first argument is considered to - be respectively less than, equal to, or greater than the - second. - </para> - <para> - <note> - <para> - If two members compare as equal, their order in the sorted array is undefined. - Up to PHP 4.0.6 the user defined functions would keep the original order for - those elements, but with the new sort algorithm introduced with 4.1.0 this - is no longer the case as there is no solution to do so in an efficient way. - </para> - </note> - </para> - &note.no-key-association; - <para> - &return.success; - </para> - <para> - <example> - <title><function>usort</function> example</title> - <programlisting role="php"> +<refentry id="function.usort"> + <refnamediv> + <refname>usort</refname> + <refpurpose>Sort an array by values using a user-defined comparison function</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <methodsynopsis> + <type>bool</type><methodname>usort</methodname> + <methodparam><type>array</type><parameter role="reference">array</parameter></methodparam> + <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> + </methodsynopsis> + <para> + This function will sort an array by its values using a + user-supplied comparison function. If the array you wish to sort + needs to be sorted by some non-trivial criteria, you should use + this function. + </para> + <para> + The comparison function must return an integer less than, equal + to, or greater than zero if the first argument is considered to + be respectively less than, equal to, or greater than the + second. + </para> + <para> + <note> + <para> + If two members compare as equal, their order in the sorted array is undefined. + Up to PHP 4.0.6 the user defined functions would keep the original order for + those elements, but with the new sort algorithm introduced with 4.1.0 this + is no longer the case as there is no solution to do so in an efficient way. + </para> + </note> + </para> + &note.no-key-association; + <para> + &return.success; + </para> + <para> + <example> + <title><function>usort</function> example</title> + <programlisting role="php"> <![CDATA[ <?php -function cmp($a, $b) +function cmp($a, $b) { if ($a == $b) { return 0; @@ -64,9 +62,9 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ 0: 1 1: 2 @@ -74,24 +72,24 @@ 3: 5 4: 6 ]]> - </screen> - </example> - </para> - <note> - <para> - Obviously in this trivial case the <function>sort</function> - function would be more appropriate. - </para> - </note> - <para> - <example> - <title> - <function>usort</function> example using multi-dimensional array - </title> - <programlisting role="php"> + </screen> + </example> + </para> + <note> + <para> + Obviously in this trivial case the <function>sort</function> + function would be more appropriate. + </para> + </note> + <para> + <example> + <title> + <function>usort</function> example using multi-dimensional array + </title> + <programlisting role="php"> <![CDATA[ <?php -function cmp($a, $b) +function cmp($a, $b) { return strcmp($a["fruit"], $b["fruit"]); } @@ -107,40 +105,40 @@ } ?> ]]> - </programlisting> - <para> - When sorting a multi-dimensional array, <varname>$a</varname> and - <varname>$b</varname> contain references to the first index of the array. - </para> - &example.outputs; - <screen> + </programlisting> + <para> + When sorting a multi-dimensional array, <varname>$a</varname> and + <varname>$b</varname> contain references to the first index of the array. + </para> + &example.outputs; + <screen> <![CDATA[ $fruits[0]: apples $fruits[1]: grapes $fruits[2]: lemons ]]> - </screen> - </example> - </para> - - <para> - <example> - <title> - <function>usort</function> example using a member function of an object - </title> - <programlisting role="php"> + </screen> + </example> + </para> + + <para> + <example> + <title> + <function>usort</function> example using a member function of an object + </title> + <programlisting role="php"> <![CDATA[ <?php class TestObj { var $name; - function TestObj($name) + function TestObj($name) { $this->name = $name; } /* This is the static comparing function: */ - function cmp_obj($a, $b) + function cmp_obj($a, $b) { $al = strtolower($a->name); $bl = strtolower($b->name); @@ -162,27 +160,27 @@ } ?> ]]> - </programlisting> - &example.outputs; - <screen> + </programlisting> + &example.outputs; + <screen> <![CDATA[ b c d ]]> - </screen> - </example> - </para> - - <para> - See also <function>uasort</function>, - <function>uksort</function>, <function>sort</function>, - <function>asort</function>, - <function>arsort</function>,<function>ksort</function>, - <function>natsort</function>, and <function>rsort</function>. - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + + <para> + See also <function>uasort</function>, + <function>uksort</function>, <function>sort</function>, + <function>asort</function>, + <function>arsort</function>,<function>ksort</function>, + <function>natsort</function>, and <function>rsort</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables:
« previous php.doc (#969374301) next »