note 70348 added to language.types.string
| From: | bogdan-AT-moongate-DOT-ro at osu1 dot php dot net | Date: | Thu, 12 Oct 2006 15:03:33 +0000 |
| Subject: | note 70348 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118457@lists.php.net to get a copy of this message | ||
Here's a nice one:
<?
$foo='test';
for($i=0;$i<10;$i++) {
$bar="one$foo";
echo memory_get_usage()."\n";
}
?>
Depending on your PHP configuration, you end up with the same value many times -- in my case,
12480
12488
12488
12488
12488
12488
12488
12488
12488
12488
Now, consider this example:
<?
$foo='test';
for($i=0;$i<10;$i++) {
$bar="another$foo"; // <-- the only change is here
echo memory_get_usage()."\n";
}
?>
The result in this case, on my server, is:
12416
12432
12448
12464
12480
12496
12512
12528
12544
12560
On my server, I have PHP 4.3.11 (cgi) (built: Nov 8 2005 06:24:40) -- but I expect it's not
the only version with this problem.
----
Server IP: 193.226.19.70
Probable Submitter: 81.181.249.130
----
Manual Page -- http://www.php.net/manual/en/language.types.string.php
Edit -- https://master.php.net/note/edit/70348
Del: integrated -- https://master.php.net/note/delete/70348/integrated
Del: useless -- https://master.php.net/note/delete/70348/useless
Del: bad code -- https://master.php.net/note/delete/70348/bad+code
Del: spam -- https://master.php.net/note/delete/70348/spam
Del: non-english -- https://master.php.net/note/delete/70348/non-english
Del: in docs -- https://master.php.net/note/delete/70348/in+docs
Del: other reasons-- https://master.php.net/note/delete/70348
Reject -- https://master.php.net/note/reject/70348
Search -- https://master.php.net/manage/user-notes.php