#47727 [NEW]: Error in Documentation: explode()
From: me at lukearmstrong dot co dot uk
Operating system: n/a
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: Error in Documentation: explode()
Description:
------------
Error in Documentation
http://uk.php.net/explode
array explode(string $delimiter, string $string [, int $limit = -1])
The default value for $limit is not -1. I assumed it would be 0, but that
does not output what I expected either. The default appears to be a value
that cannot be set, ideally this should be made clear in the
documentation.
Another bug is listed saying the default value for $limit is 0, if the
documentation has been updated to show this, the documentation will still
be wrong.
Reproduce code:
---------------
$string = 'path/to/folder/';
$array = explode('/', $string);
print_r($array)
Output: Array ( [0] => path [1] => to [2] => folder [3] => )
$string = 'path/to/folder/';
$array = explode('/', $string, -1);
print_r($array)
Output: Array ( [0] => path [1] => to [2] => folder )
$string = 'path/to/folder/';
$array = explode('/', $string, 0);
print_r($array)
Output: Array ( [0] => path/to/folder/ )
Expected result:
----------------
http://uk.php.net/explode
array explode(string $delimiter, string $string [, int $limit])
Actual result:
--------------
http://uk.php.net/explode
array explode(string $delimiter, string $string [, int $limit = -1])
--
Edit bug report at http://bugs.php.net/?id=47727&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47727&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47727&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47727&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47727&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47727&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47727&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47727&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47727&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47727&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47727&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47727&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47727&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47727&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47727&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47727&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47727&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47727&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47727&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47727&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47727&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47727&r=mysqlcfg
Thread (4 messages)
- me at lukearmstrong dot co dot uk