ID:               21182
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Arrays related
 Operating System: FreeBSD
 PHP Version:      4.2.1
 New Comment:

I searched range's source (php4/ext/standard/array.c)

It seems that problem is in string 

for (; *low <= *high; (*low) += (unsigned int)lstep) {
    add_next_index_stringl(return_value, low, 1, 1);
}

+= increments not pointer, but value, to which low points.
Therefore for(;;) iterates values between first characters of high and
low strings.


Previous Comments:
------------------------------------------------------------------------

[2002-12-25 10:02:09] [EMAIL PROTECTED]

I have the following code:

<?PHP

$a = "20";
$b = "30";
$result = range($a, $b);
echo $a;

?>

For some reason it display "40".

I know that I have to write 
$result = range((int)$a, (int)$b);
But why range() change value of argument?


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=21182&edit=1

Reply via email to