Bug #17561 Updated: str_repeat with 0 multiplier
| From: | derick@php.net | Date: | Sun, 02 Jun 2002 09:14:43 +0000 |
| Subject: | Bug #17561 Updated: str_repeat with 0 multiplier | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9139@lists.php.net to get a copy of this message | ||
ID: 17561
Updated by: derick@php.net
Reported By: lee@piclab.com
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
PHP Version: 4.2.1
New Comment:
There is no such restriction:
[derick@kossu derick]$ php
<?php
$a = 'test';
$b = 0;
echo "[".str_repeat ($a, $b)."]\n";
?>
[]
And the source as only this message:
"Second argument to %s() has to be greater than or equal to 0"
Derick
Previous Comments:
------------------------------------------------------------------------
[2002-06-02 03:06:23] lee@piclab.com
str_repeat() has the arbitary restriction that the multiplier argument
has to be greater than zero. This is pointless and annoying. It's
obvious that the right thing to do is to return an empty string for a
multiplier of zero, and this can be done with one line of code along
the lines of
if ( 0 == mult ) return "";
Why not remove this restriction?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17561&edit=1