mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Updating the range() documentation to include the new "step" parameter.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@103826 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
3be86cb45f
commit
a24b52146e
1 changed files with 12 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/array.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.range">
|
||||
<refnamediv>
|
||||
|
@ -14,12 +14,19 @@
|
|||
<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>int</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>
|
||||
<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>
|
||||
<example>
|
||||
<title><function>range</function> examples</title>
|
||||
<programlisting role="php">
|
||||
|
@ -27,6 +34,9 @@
|
|||
foreach(range(0, 9) as $number) {
|
||||
echo $number;
|
||||
}
|
||||
foreach(range(0, 100, 10) as $number) {
|
||||
echo $number;
|
||||
}
|
||||
foreach(range('a', 'z') as $letter) {
|
||||
echo $letter;
|
||||
}
|
||||
|
@ -41,6 +51,7 @@ foreach(range('z', 'a') as $letter) {
|
|||
Prior to version 4.1.0 the <function>range</function> function
|
||||
only generated incrementing integer arrays. Support for
|
||||
character sequences and decrementing arrays was added in 4.1.0.
|
||||
The <parameter>step</parameter> parameter was added in 4.4.0.
|
||||
</para>
|
||||
<example>
|
||||
<title>Simulating decrementing ranges and character sequences</title>
|
||||
|
|
Loading…
Reference in a new issue