Skip to content

Commit 85c47f8

Browse files
authored
[PHP 8.5] added array_[first|last] Documentation (#4925)
1 parent 2466135 commit 85c47f8

File tree

5 files changed

+194
-0
lines changed

5 files changed

+194
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<refentry xml:id="function.array-first" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
3+
<refnamediv>
4+
<refname>array_first</refname>
5+
<refpurpose>Gets the first value of an array</refpurpose>
6+
</refnamediv>
7+
8+
<refsect1 role="description">
9+
&reftitle.description;
10+
<methodsynopsis>
11+
<type>mixed</type><methodname>array_first</methodname>
12+
<methodparam><type>array</type><parameter>array</parameter></methodparam>
13+
</methodsynopsis>
14+
<para>
15+
Get the first value of the given <parameter>array</parameter>.
16+
</para>
17+
</refsect1>
18+
19+
<refsect1 role="parameters">
20+
&reftitle.parameters;
21+
<variablelist>
22+
<varlistentry>
23+
<term><parameter>array</parameter></term>
24+
<listitem>
25+
<para>
26+
An array.
27+
</para>
28+
</listitem>
29+
</varlistentry>
30+
</variablelist>
31+
</refsect1>
32+
33+
<refsect1 role="returnvalues">
34+
&reftitle.returnvalues;
35+
<para>
36+
Returns the first value of <parameter>array</parameter> if the array is not empty;
37+
&null; otherwise.
38+
</para>
39+
</refsect1>
40+
41+
<refsect1 role="examples">
42+
&reftitle.examples;
43+
<para>
44+
<example xml:id="array_first.example.basic">
45+
<title>Basic <function>array_first</function> Usage</title>
46+
<programlisting role="php">
47+
<![CDATA[
48+
<?php
49+
$array = [1 => 'a', 0 => 'b', 3 => 'c', 2 => 'd'];
50+
51+
$firstValue = array_first($array);
52+
53+
var_dump($firstValue);
54+
?>
55+
]]>
56+
</programlisting>
57+
&example.outputs;
58+
<screen>
59+
<![CDATA[
60+
string(1) "a"
61+
]]>
62+
</screen>
63+
</example>
64+
</para>
65+
</refsect1>
66+
67+
<refsect1 role="seealso">
68+
&reftitle.seealso;
69+
<simplelist>
70+
<member><function>array_key_first</function></member>
71+
<member><function>array_last</function></member>
72+
</simplelist>
73+
</refsect1>
74+
75+
</refentry>
76+
<!-- Keep this comment at the end of the file
77+
Local variables:
78+
mode: sgml
79+
sgml-omittag:t
80+
sgml-shorttag:t
81+
sgml-minimize-attributes:nil
82+
sgml-always-quote-attributes:t
83+
sgml-indent-step:1
84+
sgml-indent-data:t
85+
indent-tabs-mode:nil
86+
sgml-parent-document:nil
87+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
88+
sgml-exposed-tags:nil
89+
sgml-local-catalogs:nil
90+
sgml-local-ecat-files:nil
91+
End:
92+
vim600: syn=xml fen fdm=syntax fdl=2 si
93+
vim: et tw=78 syn=sgml
94+
vi: ts=1 sw=1
95+
-->

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ if (!function_exists('array_key_first')) {
9898
<refsect1 role="seealso">
9999
&reftitle.seealso;
100100
<simplelist>
101+
<member><function>array_first</function></member>
101102
<member><function>array_key_last</function></member>
102103
<member><function>reset</function></member>
103104
</simplelist>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<refsect1 role="seealso">
4444
&reftitle.seealso;
4545
<simplelist>
46+
<member><function>array_last</function></member>
4647
<member><function>array_key_first</function></member>
4748
<member><function>end</function></member>
4849
</simplelist>
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<refentry xml:id="function.array-last" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
3+
<refnamediv>
4+
<refname>array_last</refname>
5+
<refpurpose>Gets the last value of an array</refpurpose>
6+
</refnamediv>
7+
8+
<refsect1 role="description">
9+
&reftitle.description;
10+
<methodsynopsis>
11+
<type>mixed</type><methodname>array_last</methodname>
12+
<methodparam><type>array</type><parameter>array</parameter></methodparam>
13+
</methodsynopsis>
14+
<para>
15+
Get the last value of the given <parameter>array</parameter>.
16+
</para>
17+
</refsect1>
18+
19+
<refsect1 role="parameters">
20+
&reftitle.parameters;
21+
<variablelist>
22+
<varlistentry>
23+
<term><parameter>array</parameter></term>
24+
<listitem>
25+
<para>
26+
An array.
27+
</para>
28+
</listitem>
29+
</varlistentry>
30+
</variablelist>
31+
</refsect1>
32+
33+
<refsect1 role="returnvalues">
34+
&reftitle.returnvalues;
35+
<para>
36+
Returns the last value of <parameter>array</parameter> if the array is not empty;
37+
&null; otherwise.
38+
</para>
39+
</refsect1>
40+
41+
<refsect1 role="examples">
42+
&reftitle.examples;
43+
<para>
44+
<example xml:id="array_last.example.basic">
45+
<title>Basic <function>array_last</function> Usage</title>
46+
<programlisting role="php">
47+
<![CDATA[
48+
<?php
49+
$array = [1 => 'a', 0 => 'b', 3 => 'c', 2 => 'd'];
50+
51+
$lastValue = array_last($array);
52+
53+
var_dump($lastValue);
54+
?>
55+
]]>
56+
</programlisting>
57+
&example.outputs;
58+
<screen>
59+
<![CDATA[
60+
string(1) "d"
61+
]]>
62+
</screen>
63+
</example>
64+
</para>
65+
</refsect1>
66+
67+
<refsect1 role="seealso">
68+
&reftitle.seealso;
69+
<simplelist>
70+
<member><function>array_key_last</function></member>
71+
<member><function>array_first</function></member>
72+
</simplelist>
73+
</refsect1>
74+
75+
</refentry>
76+
<!-- Keep this comment at the end of the file
77+
Local variables:
78+
mode: sgml
79+
sgml-omittag:t
80+
sgml-shorttag:t
81+
sgml-minimize-attributes:nil
82+
sgml-always-quote-attributes:t
83+
sgml-indent-step:1
84+
sgml-indent-data:t
85+
indent-tabs-mode:nil
86+
sgml-parent-document:nil
87+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
88+
sgml-exposed-tags:nil
89+
sgml-local-catalogs:nil
90+
sgml-local-ecat-files:nil
91+
End:
92+
vim600: syn=xml fen fdm=syntax fdl=2 si
93+
vim: et tw=78 syn=sgml
94+
vi: ts=1 sw=1
95+
-->

reference/array/versions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<function name='array_filter' from='PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8'/>
2323
<function name='array_find' from='PHP 8 &gt;= 8.4.0'/>
2424
<function name='array_find_key' from='PHP 8 &gt;= 8.4.0'/>
25+
<function name='array_first' from='PHP 8 &gt;= 8.5.0'/>
2526
<function name='array_flip' from='PHP 4, PHP 5, PHP 7, PHP 8'/>
2627
<function name='array_intersect' from='PHP 4 &gt;= 4.0.1, PHP 5, PHP 7, PHP 8'/>
2728
<function name='array_intersect_assoc' from='PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8'/>
@@ -33,6 +34,7 @@
3334
<function name='array_key_first' from='PHP 7 &gt;= 7.3.0, PHP 8'/>
3435
<function name='array_key_last' from='PHP 7 &gt;= 7.3.0, PHP 8'/>
3536
<function name='array_keys' from='PHP 4, PHP 5, PHP 7, PHP 8'/>
37+
<function name='array_last' from='PHP 8 &gt;= 8.5.0'/>
3638
<function name='array_map' from='PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8'/>
3739
<function name='array_merge' from='PHP 4, PHP 5, PHP 7, PHP 8'/>
3840
<function name='array_merge_recursive' from='PHP 4 &gt;= 4.0.1, PHP 5, PHP 7, PHP 8'/>

0 commit comments

Comments
 (0)