Skip to content

Commit b7212d5

Browse files
[PHP 8.4] array_all, array_any, array-find, array_find_key の翻訳
1 parent d03ff9a commit b7212d5

File tree

4 files changed

+65
-65
lines changed

4 files changed

+65
-65
lines changed

reference/array/functions/array-all.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<refentry xml:id="function.array-all" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
77
<refname>array_all</refname>
8-
<refpurpose>Checks if all &array; elements satisfy a callback function</refpurpose>
8+
<refpurpose>&array; のすべての要素がコールバック関数を満たすかどうかを調べる</refpurpose>
99
</refnamediv>
1010

1111
<refsect1 role="description">
@@ -16,9 +16,9 @@
1616
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
1717
</methodsynopsis>
1818
<simpara>
19-
<function>array_all</function> returns &true;, if the given
20-
<parameter>callback</parameter> returns &true; for all elements.
21-
Otherwise the function returns &false;.
19+
<function>array_all</function> は、指定された <parameter>callback</parameter> が
20+
すべての要素に対して &true; を返す場合 &true; を返します。
21+
そうでない場合 &false; を返します。
2222
</simpara>
2323
</refsect1>
2424

@@ -29,23 +29,23 @@
2929
<term><parameter>array</parameter></term>
3030
<listitem>
3131
<simpara>
32-
The &array; that should be searched.
32+
検索する &array;
3333
</simpara>
3434
</listitem>
3535
</varlistentry>
3636
<varlistentry>
3737
<term><parameter>callback</parameter></term>
3838
<listitem>
3939
<para>
40-
The callback function to call to check each element, which must be
40+
各要素を調べるコールバック関数。シグネチャは次の通りです:
4141
<methodsynopsis>
4242
<type>bool</type><methodname><replaceable>callback</replaceable></methodname>
4343
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
4444
<methodparam><type>mixed</type><parameter>key</parameter></methodparam>
4545
</methodsynopsis>
46-
If this function returns &false;, &false; is returned from
47-
<function>array_all</function> and the callback will not be called for
48-
further elements.
46+
この関数が &false; を返すと、
47+
<function>array_all</function> から &false; が返され、
48+
以降の要素に対してはコールバックは呼び出されません。
4949
</para>
5050
</listitem>
5151
</varlistentry>
@@ -55,15 +55,15 @@
5555
<refsect1 role="returnvalues">
5656
&reftitle.returnvalues;
5757
<simpara>
58-
The function returns &true;, if <parameter>callback</parameter> returns
59-
&true; for all elements. Otherwise the function returns &false;.
58+
<parameter>callback</parameter> がすべての要素に対して &true; を返す場合、
59+
この関数は &true; を返します。そうでない場合 &false; を返します。
6060
</simpara>
6161
</refsect1>
6262

6363
<refsect1 role="examples">
6464
&reftitle.examples;
6565
<example>
66-
<title><function>array_all</function> example</title>
66+
<title><function>array_all</function> の例</title>
6767
<programlisting role="php">
6868
<![CDATA[
6969
<?php
@@ -76,17 +76,17 @@ $array = [
7676
'f' => 'elephant'
7777
];
7878
79-
// Check, if all animal names are shorter than 12 letters.
79+
// すべての動物名が12文字未満かどうかをチェックします。
8080
var_dump(array_all($array, function (string $value) {
8181
return strlen($value) < 12;
8282
}));
8383
84-
// Check, if all animal names are longer than 5 letters.
84+
// すべての動物名が5文字より長いかどうかをチェックします。
8585
var_dump(array_all($array, function (string $value) {
8686
return strlen($value) > 5;
8787
}));
8888
89-
// Check, if all array keys are strings.
89+
// すべての配列キーが文字列かどうかをチェックします。
9090
var_dump(array_all($array, function (string $value, $key) {
9191
return is_string($key);
9292
}));

reference/array/functions/array-any.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<refentry xml:id="function.array-any" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
77
<refname>array_any</refname>
8-
<refpurpose>Checks if at least one &array; element satisfies a callback function</refpurpose>
8+
<refpurpose>&array; のいずれかの要素がコールバック関数を満たすかどうかを調べる</refpurpose>
99
</refnamediv>
1010

1111
<refsect1 role="description">
@@ -16,9 +16,9 @@
1616
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
1717
</methodsynopsis>
1818
<simpara>
19-
<function>array_any</function> returns &true;, if the given
20-
<parameter>callback</parameter> returns &true; for any element.
21-
Otherwise the function returns &false;.
19+
<function>array_any</function> は、指定された<parameter>callback</parameter> が
20+
いずれかの要素に対して &true; を返す場合 &true; を返します。
21+
そうでない場合 &false; を返します。
2222
</simpara>
2323
</refsect1>
2424

@@ -29,23 +29,23 @@
2929
<term><parameter>array</parameter></term>
3030
<listitem>
3131
<simpara>
32-
The &array; that should be searched.
32+
検索する &array;
3333
</simpara>
3434
</listitem>
3535
</varlistentry>
3636
<varlistentry>
3737
<term><parameter>callback</parameter></term>
3838
<listitem>
3939
<para>
40-
The callback function to call to check each element, which must be
40+
各要素を調べるコールバック関数。シグネチャは次の通りです:
4141
<methodsynopsis>
4242
<type>bool</type><methodname><replaceable>callback</replaceable></methodname>
4343
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
4444
<methodparam><type>mixed</type><parameter>key</parameter></methodparam>
4545
</methodsynopsis>
46-
If this function returns &true;, &true; is returned from
47-
<function>array_any</function> and the callback will not be called for
48-
further elements.
46+
この関数が &true; を返すと、
47+
<function>array_any</function> から &true; が返され、
48+
以降の要素に対してはコールバックは呼び出されません。
4949
</para>
5050
</listitem>
5151
</varlistentry>
@@ -55,16 +55,16 @@
5555
<refsect1 role="returnvalues">
5656
&reftitle.returnvalues;
5757
<simpara>
58-
The function returns &true;, if there is at least one element for which
59-
<parameter>callback</parameter> returns &true;. Otherwise the function
60-
returns &false;.
58+
この関数は、<parameter>callback</parameter> が &true; を返す要素が
59+
少なくとも1つある場合、&true; を返します。
60+
そうでない場合 &false; を返します。
6161
</simpara>
6262
</refsect1>
6363

6464
<refsect1 role="examples">
6565
&reftitle.examples;
6666
<example>
67-
<title><function>array_any</function> example</title>
67+
<title><function>array_any</function> の例</title>
6868
<programlisting role="php">
6969
<![CDATA[
7070
<?php
@@ -77,17 +77,17 @@ $array = [
7777
'f' => 'elephant'
7878
];
7979
80-
// Check, if any animal name is longer than 5 letters.
80+
// いずれかの動物名が5文字より長いかどうかをチェックします。
8181
var_dump(array_any($array, function (string $value) {
8282
return strlen($value) > 5;
8383
}));
8484
85-
// Check, if any animal name is shorter than 3 letters.
85+
// いずれかの動物名が3文字より短いかどうかをチェックします。
8686
var_dump(array_any($array, function (string $value) {
8787
return strlen($value) < 3;
8888
}));
8989
90-
// Check, if any array key is not a string.
90+
// 配列キーに文字列でないものがあるかどうかをチェックします。
9191
var_dump(array_any($array, function (string $value, $key) {
9292
return !is_string($key);
9393
}));

reference/array/functions/array-find-key.xml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<refentry xml:id="function.array-find-key" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
77
<refname>array_find_key</refname>
8-
<refpurpose>Returns the key of the first element satisfying a callback function</refpurpose>
8+
<refpurpose>コールバック関数を満たす最初の要素のキーを返す</refpurpose>
99
</refnamediv>
1010

1111
<refsect1 role="description">
@@ -16,9 +16,9 @@
1616
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
1717
</methodsynopsis>
1818
<simpara>
19-
<function>array_find_key</function> returns the key of the first element of an
20-
&array; for which the given <parameter>callback</parameter> returns &true;.
21-
If no matching element is found the function returns &null;.
19+
<function>array_find_key</function> は、指定された
20+
<parameter>callback</parameter> &true; を返す &array; の最初の要素のキーを返します。
21+
見つからない場合 &null; を返します。
2222
</simpara>
2323
</refsect1>
2424

@@ -29,23 +29,23 @@
2929
<term><parameter>array</parameter></term>
3030
<listitem>
3131
<simpara>
32-
The &array; that should be searched.
32+
検索する &array;
3333
</simpara>
3434
</listitem>
3535
</varlistentry>
3636
<varlistentry>
3737
<term><parameter>callback</parameter></term>
3838
<listitem>
3939
<para>
40-
The callback function to call to check each element, which must be
40+
各要素を調べるコールバック関数。シグネチャは次の通りです:
4141
<methodsynopsis>
4242
<type>bool</type><methodname><replaceable>callback</replaceable></methodname>
4343
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
4444
<methodparam><type>mixed</type><parameter>key</parameter></methodparam>
4545
</methodsynopsis>
46-
If this function returns &true;, the key is returned from
47-
<function>array_find_key</function> and the callback will not be called
48-
for further elements.
46+
この関数が &true; を返すと、
47+
その要素のキーが <function>array_find_key</function> から返され、
48+
以降の要素に対してはコールバックは呼び出されません。
4949
</para>
5050
</listitem>
5151
</varlistentry>
@@ -55,16 +55,16 @@
5555
<refsect1 role="returnvalues">
5656
&reftitle.returnvalues;
5757
<simpara>
58-
The function returns the key of the first element for which the
59-
<parameter>callback</parameter> returns &true;. If no matching element is
60-
found the function returns &null;.
58+
<parameter>callback</parameter> が &true; を返す最初の要素のキーを返します。
59+
一致する要素が見つからない場合、
60+
&null; を返します。
6161
</simpara>
6262
</refsect1>
6363

6464
<refsect1 role="examples">
6565
&reftitle.examples;
6666
<example>
67-
<title><function>array_find_key</function> example</title>
67+
<title><function>array_find_key</function> の例</title>
6868
<programlisting role="php">
6969
<![CDATA[
7070
<?php
@@ -77,22 +77,22 @@ $array = [
7777
'f' => 'elephant'
7878
];
7979
80-
// Find the first animal with a name longer than 4 characters.
80+
// 名前が4文字より長い最初の動物を探します。
8181
var_dump(array_find_key($array, function (string $value) {
8282
return strlen($value) > 4;
8383
}));
8484
85-
// Find the first animal whose name begins with f.
85+
// 名前がfで始まる最初の動物を探します。
8686
var_dump(array_find_key($array, function (string $value) {
8787
return str_starts_with($value, 'f');
8888
}));
8989
90-
// Find the first animal where the array key is the first symbol of the animal.
90+
// 配列キーが動物の最初の文字と一致する最初の動物を探します。
9191
var_dump(array_find_key($array, function (string $value, $key) {
9292
return $value[0] === $key;
9393
}));
9494
95-
// Find the first animal where the array key matching a RegEx.
95+
// 配列キーが正規表現にマッチする最初の動物を探します。
9696
var_dump(array_find_key($array, function ($value, $key) {
9797
return preg_match('/^([a-f])$/', $key);
9898
}));

reference/array/functions/array-find.xml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<refentry xml:id="function.array-find" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
77
<refname>array_find</refname>
8-
<refpurpose>Returns the first element satisfying a callback function</refpurpose>
8+
<refpurpose>コールバック関数を満たす最初の要素を返す</refpurpose>
99
</refnamediv>
1010

1111
<refsect1 role="description">
@@ -16,9 +16,9 @@
1616
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
1717
</methodsynopsis>
1818
<simpara>
19-
<function>array_find</function> returns the value of the first element of an
20-
&array; for which the given <parameter>callback</parameter> returns &true;.
21-
If no matching element is found the function returns &null;.
19+
<function>array_find</function> は、指定された
20+
<parameter>callback</parameter> &true; を返す &array; の最初の要素を返します。
21+
見つからない場合 &null; を返します。
2222
</simpara>
2323
</refsect1>
2424

@@ -29,23 +29,23 @@
2929
<term><parameter>array</parameter></term>
3030
<listitem>
3131
<simpara>
32-
The &array; that should be searched.
32+
検索する &array;
3333
</simpara>
3434
</listitem>
3535
</varlistentry>
3636
<varlistentry>
3737
<term><parameter>callback</parameter></term>
3838
<listitem>
3939
<para>
40-
The callback function to call to check each element, which must be
40+
各要素を調べるコールバック関数。シグネチャは次の通りです:
4141
<methodsynopsis>
4242
<type>bool</type><methodname><replaceable>callback</replaceable></methodname>
4343
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
4444
<methodparam><type>mixed</type><parameter>key</parameter></methodparam>
4545
</methodsynopsis>
46-
If this function returns &true;, the value is returned from
47-
<function>array_find</function> and the callback will not be called for
48-
further elements.
46+
この関数が &true; を返すと、
47+
その要素が <function>array_find</function> から返され、
48+
以降の要素に対してはコールバックは呼び出されません。
4949
</para>
5050
</listitem>
5151
</varlistentry>
@@ -55,16 +55,16 @@
5555
<refsect1 role="returnvalues">
5656
&reftitle.returnvalues;
5757
<simpara>
58-
The function returns the value of the first element for which the
59-
<parameter>callback</parameter> returns &true;. If no matching element is
60-
found the function returns &null;.
58+
<parameter>callback</parameter> が &true; を返す最初の要素を返します。
59+
一致する要素が見つからない場合、
60+
&null; を返します。
6161
</simpara>
6262
</refsect1>
6363

6464
<refsect1 role="examples">
6565
&reftitle.examples;
6666
<example>
67-
<title><function>array_find</function> example</title>
67+
<title><function>array_find</function> の例</title>
6868
<programlisting role="php">
6969
<![CDATA[
7070
<?php
@@ -77,22 +77,22 @@ $array = [
7777
'f' => 'elephant'
7878
];
7979
80-
// Find the first animal with a name longer than 4 characters.
80+
// 名前が4文字より長い最初の動物を探します。
8181
var_dump(array_find($array, function (string $value) {
8282
return strlen($value) > 4;
8383
}));
8484
85-
// Find the first animal whose name begins with f.
85+
// 名前がfで始まる最初の動物を探します。
8686
var_dump(array_find($array, function (string $value) {
8787
return str_starts_with($value, 'f');
8888
}));
8989
90-
// Find the first animal where the array key is the first symbol of the animal.
90+
// キーが動物の名前の最初の文字と一致する最初の動物を探します。
9191
var_dump(array_find($array, function (string $value, $key) {
9292
return $value[0] === $key;
9393
}));
9494
95-
// Find the first animal where the array key matching a RegEx.
95+
// キーが正規表現にマッチする最初の動物を探します。
9696
var_dump(array_find($array, function ($value, $key) {
9797
return preg_match('/^([a-f])$/', $key);
9898
}));

0 commit comments

Comments
 (0)