#47546 [NEW]: Default value for limit parameter in explode is 0, not -1

From: Date: Mon, 02 Mar 2009 17:25:27 +0000
Subject: #47546 [NEW]: Default value for limit parameter in explode is 0, not -1
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1932@lists.php.net to get a copy of this message
From: jordi dot salvat at localbilinglimited dot com Operating system: Irrelevant PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Default value for limit parameter in explode is 0, not -1 Description: ------------ http://es.php.net/explode declares that the default value for the 3rd parameter of the explode function is -1. The function, however, behaves differently when -1 is passed explicitly. Reproduce code: --------------- php <<'__END__' <?php $str = 'one|two|three|four'; print_r(explode('|', $str)); print_r(explode('|', $str, -1)); ?> __END__ Expected result: ---------------- From the documentation, I would expect to see the same result twice. Actual result: -------------- Array ( [0] => one [1] => two [2] => three [3] => four ) Array ( [0] => one [1] => two [2] => three ) -- Edit bug report at http://bugs.php.net/?id=47546&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47546&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47546&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47546&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47546&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47546&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47546&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47546&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47546&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47546&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47546&r=support Expected behavior: http://bugs.php.net/fix.php?id=47546&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47546&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47546&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47546&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47546&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47546&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47546&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47546&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47546&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47546&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47546&r=mysqlcfg

« previous php.doc.bugs (#1932) next »