svn: /phpdoc/en/trunk/reference/strings/functions/ substr.xml

From: Date: Sun, 07 Nov 2010 19:53:45 +0000
Subject: svn: /phpdoc/en/trunk/reference/strings/functions/ substr.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-7387@lists.php.net to get a copy of this message
frozenfire Sun, 07 Nov 2010 19:53:45 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=305175 Log: Indicated change to substr's behaviour with start positions beyond truncation positions. Added changelog indicating this BC break. Bug #53252. Bug: http://bugs.php.net/53252 (Assigned) Invalid type (boolean) returned by substr() when providing an empty string Changed paths: U phpdoc/en/trunk/reference/strings/functions/substr.xml Modified: phpdoc/en/trunk/reference/strings/functions/substr.xml =================================================================== --- phpdoc/en/trunk/reference/strings/functions/substr.xml 2010-11-07 19:45:51 UTC (rev 305174) +++ phpdoc/en/trunk/reference/strings/functions/substr.xml 2010-11-07 19:53:45 UTC (rev 305175) @@ -83,8 +83,8 @@ 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 @@ <?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 @@ 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;

« previous php.doc.cvs (#7387) next »