mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Added changed strtok behavior to the manual
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@65267 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
d4a1917f42
commit
25e51e3e37
1 changed files with 36 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.139 $ -->
|
||||
<!-- $Revision: 1.140 $ -->
|
||||
<reference id="ref.strings">
|
||||
<title>String functions</title>
|
||||
<titleabbrev>Strings</titleabbrev>
|
||||
|
@ -3425,6 +3425,41 @@ while ($tok) {
|
|||
tokenized when any one of the characters in the argument are
|
||||
found.
|
||||
</para>
|
||||
<para>
|
||||
The behavior when an empty part was found changed with PHP 4.1.0. The old
|
||||
behavior returned an empty string, while the new, correct, behavior
|
||||
simply skips the part of the string:
|
||||
<example>
|
||||
<title>Old <function>strtok</function> behavior</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
$first_token = strtok('/something', '/');
|
||||
$second_token = strtok('/');
|
||||
var_dump ($first_token, $second_token);
|
||||
|
||||
/* Output:
|
||||
string(0) ""
|
||||
string(9) "something"
|
||||
*/
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>New <function>strtok</function> behavior</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
$first_token = strtok('/something', '/');
|
||||
$second_token = strtok('/');
|
||||
var_dump ($first_token, $second_token);
|
||||
|
||||
/* Output:
|
||||
string(9) "something"
|
||||
bool(false)
|
||||
*/
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Also be careful that your tokens may be equal to "0". This
|
||||
evaluates to &false; in conditional expressions.
|
||||
|
|
Loading…
Reference in a new issue