#32785 [Opn]: negative limit doesn't work in explode()
| From: | derick@php.net | Date: | Wed, 20 Apr 2005 21:55:40 +0000 |
| Subject: | #32785 [Opn]: negative limit doesn't work in explode() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-77974@lists.php.net to get a copy of this message | ||
ID: 32785
Updated by: derick@php.net
Reported By: proton@php.net
Status: Open
Bug Type: Arrays related
Operating System: Debian GNU/Linux
PHP Version: 4.3.10
New Comment:
You switched actual and expected though...
Previous Comments:
------------------------------------------------------------------------
[2005-04-20 23:45:39] proton@php.net
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