ID: 32785 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Bogus +Status: Open -Bug Type: Arrays related +Bug Type: Documentation problem Operating System: Debian GNU/Linux PHP Version: 4.3.10 New Comment:
Reclassified as documentation problem: The examples should have BIG note about the being like that only with PHP 5.1!!!! Previous Comments: ------------------------------------------------------------------------ [2005-04-21 00:42:22] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Negative limits are only supported in PHP 5.1 ------------------------------------------------------------------------ [2005-04-21 00:03:55] [EMAIL PROTECTED] It does the same on current PHP-version also. nandus% uname -a FreeBSD nandus.mikrolahti.fi 5.4-STABLE FreeBSD 5.4-STABLE #0: Tue Apr 19 23:27:27 EEST 2005 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/NANDUS i386 nandus% cat explode.php <?php $str = 'one|two|three|four'; // positive limit print_r(explode('|', $str, 2)); // negative limit print_r(explode('|', $str, -1)); ?> nandus% php explode.php Content-type: text/html X-Powered-By: PHP/5.0.4 Array ( [0] => one [1] => two|three|four ) Array ( [0] => one [1] => two [2] => three [3] => four ) ------------------------------------------------------------------------ [2005-04-20 23:45:39] [EMAIL PROTECTED] Description: ------------ http://www.php.net/explode Manual gives an example of limit-parameter used in explode(). Example 2 shows negative limit-value example and it seems not working like expected. Test-code at web: http://mikrolahti.fi/explode.php Reproduce code: --------------- <?php $str = 'one|two|three|four'; // positive limit print_r(explode('|', $str, 2)); // negative limit print_r(explode('|', $str, -1)); ?> Expected result: ---------------- Array ( [0] => one [1] => two|three|four ) Array ( [0] => one [1] => two [2] => three ) Actual result: -------------- Array ( [0] => one [1] => two|three|four ) Array ( [0] => one [1] => two [2] => three [3] => four ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32785&edit=1