Indicated change to substr's behaviour with start positions beyond truncation positions.

Added changelog indicating this BC break. Bug #53252.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@305175 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Justin Martin 2010-11-07 19:53:45 +00:00
parent c1a545fd27
commit 3ed5f72b6c

View file

@ -83,8 +83,8 @@ $rest = substr("abcdef", -3, 1); // returns "d"
characters will be omitted from the end of <parameter>string</parameter>
(after the start position has been calculated when a
<parameter>start</parameter> is negative). If
<parameter>start</parameter> denotes a position beyond this truncation,
an empty string will be returned.
<parameter>start</parameter> denotes the position of this truncation or
beyond, false will be returned.
</para>
<para>
If <parameter>length</parameter> is given and is <literal>0</literal>,
@ -102,7 +102,7 @@ $rest = substr("abcdef", -3, 1); // returns "d"
<?php
$rest = substr("abcdef", 0, -1); // returns "abcde"
$rest = substr("abcdef", 2, -1); // returns "cde"
$rest = substr("abcdef", 4, -4); // returns ""
$rest = substr("abcdef", 4, -4); // returns false
$rest = substr("abcdef", -3, -1); // returns "de"
?>
]]>
@ -120,6 +120,32 @@ $rest = substr("abcdef", -3, -1); // returns "de"
Returns the extracted part of string, &return.falseforfailure; or an empty string.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>5.2.2</entry>
<entry>
If the <parameter>start</parameter> parameter indicates the position of
a negative truncation or beyond, false is returned. Prior to this
version, an empty string was returned.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;