cvs: phpdoc /en/reference/array/functions array-diff-assoc.xml array-diff-uassoc.xml array-udiff-assoc.xml array-udiff-uassoc.xml array-udiff.xml

From: Date: Mon, 03 Nov 2003 14:05:07 +0000
Subject: cvs: phpdoc /en/reference/array/functions array-diff-assoc.xml array-diff-uassoc.xml array-udiff-assoc.xml array-udiff-uassoc.xml array-udiff.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969356811@lists.php.net to get a copy of this message
didou Mon Nov 3 09:05:07 2003 EDT Modified files: /phpdoc/en/reference/array/functions array-diff-assoc.xml array-diff-uassoc.xml array-udiff-assoc.xml array-udiff-uassoc.xml array-udiff.xml Log: using screen tag for the examples converting tabs to spaces in the examples there is some noise with WS that I was unable to reduce, but my WS seems to be ok

Index: phpdoc/en/reference/array/functions/array-diff-assoc.xml diff -u phpdoc/en/reference/array/functions/array-diff-assoc.xml:1.3 phpdoc/en/reference/array/functions/array-diff-assoc.xml:1.4 --- phpdoc/en/reference/array/functions/array-diff-assoc.xml:1.3 Sun Aug 17 08:21:03 2003 +++ phpdoc/en/reference/array/functions/array-diff-assoc.xml Mon Nov 3 09:05:07 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> <refentry id="function.array-diff-assoc"> <refnamediv> @@ -18,7 +18,7 @@ <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 + Note that the keys are used in the comparison unlike <function>array_diff</function>. </para> <para> @@ -30,18 +30,23 @@ $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); $result = array_diff_assoc($array1, $array2); - -/* The result is: +print_r($result); +?> +]]> + </programlisting> + <para> + The result is: + </para> + <screen> +<![CDATA[ Array ( [b] => brown [c] => blue [0] => red ) -*/ -?> ]]> - </programlisting> + </screen> </example> </para> <simpara> Index: phpdoc/en/reference/array/functions/array-diff-uassoc.xml diff -u phpdoc/en/reference/array/functions/array-diff-uassoc.xml:1.1 phpdoc/en/reference/array/functions/array-diff-uassoc.xml:1.2 --- phpdoc/en/reference/array/functions/array-diff-uassoc.xml:1.1 Thu Oct 9 03:28:40 2003 +++ phpdoc/en/reference/array/functions/array-diff-uassoc.xml Mon Nov 3 09:05:07 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> <refentry id="function.array-diff-uassoc"> <refnamediv> @@ -19,7 +19,7 @@ <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 + Note that the keys are used in the comparison unlike <function>array_diff</function>. 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 @@ -34,33 +34,37 @@ <![CDATA[ <?php function key_compare_func($a, $b) { - if ($a === $b) return 0; - return ($a > $b)? 1:-1; + if ($a === $b) return 0; + return ($a > $b)? 1:-1; } $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); $result = array_diff_uassoc($array1, $array2, "key_compare_func"); - -/* The result is: +?> +]]> + </programlisting> + <para> + The result is: + </para> + <screen> +<![CDATA[ Array ( [b] => brown [c] => blue [0] => red ) -*/ -?> ]]> - </programlisting> + </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> + 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>. + has key which is <literal>1</literal>. </simpara> <simpara> The equality of 2 indices is checked by the user supplied callback function. @@ -68,7 +72,7 @@ <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, + 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> Index: phpdoc/en/reference/array/functions/array-udiff-assoc.xml diff -u phpdoc/en/reference/array/functions/array-udiff-assoc.xml:1.1 phpdoc/en/reference/array/functions/array-udiff-assoc.xml:1.2 --- phpdoc/en/reference/array/functions/array-udiff-assoc.xml:1.1 Thu Oct 9 03:28:40 2003 +++ phpdoc/en/reference/array/functions/array-udiff-assoc.xml Mon Nov 3 09:05:07 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> <refentry id="function.array-udiff-assoc"> <refnamediv> @@ -33,14 +33,14 @@ <![CDATA[ <?php class cr { - private $priv_member; + private $priv_member; function cr($val) { - $this->priv_member = $val; - } - static function comp_func_cr($a, $b) { - if ($a->priv_member === $b->priv_member) return 0; - return ($a->priv_member > $b->priv_member)? 1:-1; - } + $this->priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member)? 1:-1; + } } $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr( 3), 1=> new cr(4), 2 => new cr(-15),); @@ -48,8 +48,13 @@ $result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr")); print_r($result); ?> - -/* The result is: +]]> + </programlisting> + <para> + The result is: + </para> + <screen> +<![CDATA[ Array ( [0.1] => cr Object @@ -67,16 +72,14 @@ [priv_member:private] => 23 ) ) -*/ -?> ]]> - </programlisting> + </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. + function. </simpara> <simpara> For comparison is used the user supplied callback function. Index: phpdoc/en/reference/array/functions/array-udiff-uassoc.xml diff -u phpdoc/en/reference/array/functions/array-udiff-uassoc.xml:1.2 phpdoc/en/reference/array/functions/array-udiff-uassoc.xml:1.3 --- phpdoc/en/reference/array/functions/array-udiff-uassoc.xml:1.2 Fri Oct 10 01:08:09 2003 +++ phpdoc/en/reference/array/functions/array-udiff-uassoc.xml Mon Nov 3 09:05:07 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> <refentry id="function.array-udiff-uassoc"> <refnamediv> @@ -38,18 +38,18 @@ <![CDATA[ <?php class cr { - private $priv_member; + private $priv_member; function cr($val) { - $this->priv_member = $val; - } - static function comp_func_cr($a, $b) { - if ($a->priv_member === $b->priv_member) return 0; - return ($a->priv_member > $b->priv_member)? 1:-1; - } - static function comp_func_key($a, $b) { - if ($a === $b) return 0; - return ($a > $b)? 1:-1; - } + $this->priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member)? 1:-1; + } + static function comp_func_key($a, $b) { + if ($a === $b) return 0; + return ($a > $b)? 1:-1; + } } $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr( 3), 1=> new cr(4), 2 => new cr(-15),); @@ -57,8 +57,13 @@ $result = array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr","comp_func_key")); print_r($result); ?> - -/* The result is: +]]> + </programlisting> + <para> + The result is: + </para> + <screen> +<![CDATA[ Array ( [0.1] => cr Object @@ -76,16 +81,14 @@ [priv_member:private] => 23 ) ) -*/ -?> ]]> - </programlisting> + </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. + function. Keep in mind that you have to supply 2 callback functions. </simpara> <simpara> For comparison is used the user supplied callback function. Index: phpdoc/en/reference/array/functions/array-udiff.xml diff -u phpdoc/en/reference/array/functions/array-udiff.xml:1.1 phpdoc/en/reference/array/functions/array-udiff.xml:1.2 --- phpdoc/en/reference/array/functions/array-udiff.xml:1.1 Thu Oct 9 03:28:40 2003 +++ phpdoc/en/reference/array/functions/array-udiff.xml Mon Nov 3 09:05:07 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.14 --> <refentry id="function.array-udiff"> <refnamediv> @@ -34,22 +34,28 @@ <![CDATA[ <?php class cr { - private $priv_member; + private $priv_member; function cr($val) { - $this->priv_member = $val; - } - static function comp_func_cr($a, $b) { - if ($a->priv_member === $b->priv_member) return 0; - return ($a->priv_member > $b->priv_member)? 1:-1; - } + $this->priv_member = $val; + } + static function comp_func_cr($a, $b) { + if ($a->priv_member === $b->priv_member) return 0; + return ($a->priv_member > $b->priv_member)? 1:-1; + } } $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr( 3), 1=> new cr(4), 2 => new cr(-15),); $result = array_udiff($a, $b, array("cr", "comp_func_cr")); print_r($result); - -/* The result is: +?> +]]> + </programlisting> + <para> + The result is: + </para> + <screen> +<![CDATA[ Array ( [0.5] => cr Object @@ -63,10 +69,8 @@ ) ) -*/ -?> ]]> - </programlisting> + </screen> </example> </para> <note>
« previous php.doc (#969356811) next »