#20251 [WFx->Opn]: Can't assign values to array in loop.
| From: | director at misny dot com | Date: | Tue, 05 Nov 2002 23:46:15 +0000 |
| Subject: | #20251 [WFx->Opn]: Can't assign values to array in loop. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-24154@lists.php.net to get a copy of this message | ||
ID: 20251
User updated by: director@misny.com
Reported By: director@misny.com
-Status: Won't fix
+Status: Open
Bug Type: Arrays related
Operating System: linux 2.4.7-10enterprise #1 SMP
PHP Version: 4.2.1
New Comment:
Thank you. I don't know much about the development of Zend engine, so
I guess I'll wait for ZE2 to be included in future release of PHP.
I had posted a bad sample code. I wasn't trying to fill an array with
the same value, so it should have been:
<?
$a=80000;
for($i=0; $i<$a; $i++){
$c[$i]=$i;
}
echo count($c);
?>
And, by the way, this also crashes when $a gets too high or is coupled
with another similar loop in the same script:
<?
$a=1000000;
for($i=0; $i<$a; $i++){
$d="ar".$i;
$$d=$i;
}
echo $ar5943;
?>
If these work in ZE2, should I bother to do a gdb backtrace using ZE1?
Previous Comments:
------------------------------------------------------------------------
[2002-11-05 08:08:26] iliaa@php.net
In ZE1 use array_fill() to fill in an array with the same value, it'll
be faster and work. In ZE2 your code will work fine as is, still
array_fill() would probably be a better alternative.
------------------------------------------------------------------------
[2002-11-04 19:23:34] nicos@php.net
Okay, Please join a gdb backtrace.
------------------------------------------------------------------------
[2002-11-04 19:12:02] director@misny.com
The following works in place of array, so I'll try and see how much
memory and CPU this uses.
<?
$a=1000000;
for($i=0; $i<$a; $i++){
$d="ar".$i;
$$d=$i;
}
echo $ar5943;
?>
------------------------------------------------------------------------
[2002-11-04 18:50:58] nicos@php.net
ilia said it was reproductile with any values larger than 66000
------------------------------------------------------------------------
[2002-11-04 18:50:47] director@misny.com
I apologize if you think this is not the appropriate place, but I had
confered with a couple of other developers who experienced the same
problem when this was run, so I figured it was a php bug. I'll do more
research (trying it on windows, maybe) and see what I come up with.
Sorry to waste your time.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/20251
--
Edit this bug report at http://bugs.php.net/?id=20251&edit=1