cvs: phpdoc-ja /reference/array/functions array-multisort.xml
| From: | TAKAGI Masahiro | Date: | Sun, 07 Aug 2005 06:30:23 +0000 |
| Subject: | cvs: phpdoc-ja /reference/array/functions array-multisort.xml | ||
| Groups: | php.doc.ja | ||
| Request: | Send a blank email to doc-ja+get-1109@lists.php.net to get a copy of this message | ||
takagi Sun Aug 7 02:30:23 2005 EDT
Modified files:
/phpdoc-ja/reference/array/functions array-multisort.xml
Log:
sync with en.
http://cvs.php.net/diff.php/phpdoc-ja/reference/array/functions/array-multisort.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc-ja/reference/array/functions/array-multisort.xml
diff -u phpdoc-ja/reference/array/functions/array-multisort.xml:1.5
phpdoc-ja/reference/array/functions/array-multisort.xml:1.6
--- phpdoc-ja/reference/array/functions/array-multisort.xml:1.5 Wed Dec 15 11:00:27 2004
+++ phpdoc-ja/reference/array/functions/array-multisort.xml Sun Aug 7 02:30:22 2005
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 1.13 Maintainer: hirokawa Status: working -->
+<!-- $Revision: 1.6 $ -->
+<!-- EN-Revision: 1.17 Maintainer: hirokawa Status: ready -->
+<!-- CREDITS: takagi -->
<refentry id="function.array-multisort">
<refnamediv>
<refname>array_multisort</refname>
@@ -115,31 +117,37 @@
<programlisting role="php">
<![CDATA[
<?php
-$ar = array (array ("10", 100, 100, "a"), array (1, 3, "2", 1));
+$ar = array(
+ array("10", 11, 100, 100, "a"),
+ array( 1, 2, "2", 3, 1)
+ );
array_multisort ($ar[0], SORT_ASC, SORT_STRING,
$ar[1], SORT_NUMERIC, SORT_DESC);
+var_dump($ar);
?>
]]>
</programlisting>
<para>
-
ãã®ä¾ã§ã¯ãã½ã¼ããããå¾ãæåã®é
åã¯10,100,
100, "a" (æåå
-
ã¨ãã¦æé ã§ã½ã¼ãããã¦ãã¾ã)ãæãã¦ããã2çªç®ã®é
åã¯ã
- 1, 3, "2", 1
(æ°å¤ã¨ãã¦éé ã«ã½ã¼ãããã¦ãã¾ã)ã¨ãªã£ã¦ãã¾ãã
+
ãã®ä¾ã§ã¯ãã½ã¼ããããå¾ãæåã®é
åã¯
"10", 100, 100, 11, "a" (æåå
+
ã¨ãã¦æé ã§ã½ã¼ãããã¦ãã¾ã)ã«å¤æããã2
çªç®ã®é
åã¯ã
+ 1, 3, "2", 2, 1
(æ°å¤ã¨ãã¦éé ã«ã½ã¼ãããã¦ãã¾ã)ã¨ãªã£ã¦ãã¾ãã
</para>
<screen>
<![CDATA[
array(2) {
- [0]=> array(4) {
+ [0]=> array(5) {
[0]=> string(2) "10"
[1]=> int(100)
[2]=> int(100)
- [3]=> string(1) "a"
+ [3]=> int(11)
+ [4]=> string(1) "a"
}
- [1]=> array(4) {
+ [1]=> array(5) {
[0]=> int(1)
[1]=> int(3)
[2]=> string(1) "2"
- [3]=> int(1)
+ [3]=> int(2)
+ [4]=> int(1)
}
}
]]>
@@ -149,14 +157,14 @@
<para>
<example>
- <title>Sorting database results</title>
+
<title>ãã¼ã¿ãã¼ã¹ã®çµæãã½ã¼ããã</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.
+ ãã®ä¾ã§ã¯ãé
å <varname>data</varname>
ã®åã
ã®è¦ç´ ã
+
ãã¼ãã«ã®ã²ã¨ã¤ã®è¡ã表ãã¦ãã¾ããããã¯ããã¼ã¿ãã¼ã¹ã®
+ ã¬ã³ã¼ãã®å
¸åçãªå½¢å¼ã§ãã
</para>
<para>
- Example data:
+ ãã¼ã¿ã®ä¾:
</para>
<screen>
<![CDATA[
@@ -171,8 +179,9 @@
]]>
</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>.
+ ãã¼ã¿ã¯ <varname>data</varname>
ã¨ããååã®é
åã«æ ¼ç´ãã¾ãã
+ ããã¯ãä¾ãã°
<function>mysql_fetch_assoc</function> ã®çµæã
+
ã«ã¼ãããããããã°å¾ããã¾ãã
</para>
<programlisting role="php">
<![CDATA[
@@ -185,33 +194,33 @@
$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 the below code to obtain the
- columns, then perform the sorting.
- </para>
- <programlisting role="php">
+ </programlisting>
+ <para>
+ ãã®ä¾ã§ã¯ããã¼ã¿ã
<varname>volume</varname> ã®éé ã
+ <varname>edition</varname>
ã®æé ã«ä¸¦ã¹æ¿ãã¾ãã
+ </para>
+ <para>
+
ç§ãã¡ãä»ãã£ã¦ããã®ã¯è¡æ¹åã®é
åã§ããã
+ <function>array_multisort</function>
ã§å¿
è¦ãªã®ã¯åæ¹åã®é
åã§ãã
+
ããã§ã以ä¸ã®ã³ã¼ãã§åæ¹åã®é
åãå¾ããã¨ã§ã½ã¼ããè¡ãã¾ãã
+ </para>
+ <programlisting role="php">
<![CDATA[
<?php
-// Obtain a list of columns
+// åæ¹åã®é
åãå¾ã
foreach ($data as $key => $row) {
$volume[$key] = $row['volume'];
$edition[$key] = $row['edition'];
}
-// Sort the data with volume descending, edition ascending
-// Add $data as the last parameter, to sort by the common key
+// ãã¼ã¿ã volume ã®éé ãedition
ã®æé ã«ã½ã¼ãããã
+// $data
ãæå¾ã®ãã©ã¡ã¼ã¿ã¨ãã¦æ¸¡ããåããã¼ã§ã½ã¼ãããã
array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data);
?>
]]>
</programlisting>
<para>
- The dataset is now sorted, and will look like this:
+
ãã¼ã¿ã»ããã®è¡ã¯ã½ã¼ãããã以ä¸ã®ããã«ãªãã¾ã:
</para>
<screen>
<![CDATA[
@@ -224,24 +233,23 @@
67 | 2
67 | 7
]]>
- </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.
+ </screen>
+ </example>
</para>
+
<para>
- To perform a case insensitve search, force the sorting order to be
- determined by a lowercase copy of the original array.
- </para>
- <programlisting role="php">
+ <example>
+
<title>大æåã»å°æåãåºå¥ããªãã½ã¼ã</title>
+ <para>
+ <constant>SORT_STRING</constant> ã¨
+ <constant>SORT_REGULAR</constant>
ã¯ã©ã¡ãã大æåã»å°æåãåºå¥ãã
+
大æåã§ã¯ãã¾ãæååãå°æåã§å§ã¾ãæååããåã«ãªãã¾ãã
+ </para>
+ <para>
+
大æåã»å°æåãåºå¥ããªãããã«ã¯ãå
ã®é
åã®å
容ããã¹ã¦å°æåã«
+
夿ããé
åãç¨æãããããã½ã¼ãã®åºæºã«ãã¾ãã
+ </para>
+ <programlisting role="php">
<![CDATA[
$array = array('Alpha', 'atomic', 'Beta', 'bank');
$array_lowercase = array_map('strtolower', $array);
@@ -250,9 +258,9 @@
print_r($array);
]]>
- </programlisting>
- &example.outputs;
- <screen>
+ </programlisting>
+ &example.outputs;
+ <screen>
<![CDATA[
Array
(
@@ -262,11 +270,12 @@
[3] => Beta
)
]]>
- </screen>
- </example>
- </para>
- </refsect1>
-</refentry>
+ </screen>
+ </example>
+ </para>
+
+ </refsect1>
+ </refentry>
<!-- Keep this comment at the end of the file
Local variables: