note 36807 added to language.operators.string
| From: | drapia at hotmail dot com | Date: | Thu, 23 Oct 2003 08:39:13 +0000 |
| Subject: | note 36807 added to language.operators.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59156@lists.php.net to get a copy of this message | ||
operator .= will cause memory wasting
while(1) {
$L=rand(1,500);
$a="";
for($g=0;$g<$L;$g++) {
$a.="1";
};
};
will use memory from 2684 KB to 2848 KB
however, if use $a=$a."1"; instread of $a.="1";
the memory use just 2684 KB always
This may cause memory full problem is you write a big CGI application.
----
Manual Page -- http://www.php.net/manual/en/language.operators.string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36807
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36807&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36807&report=yes
Search -- http://master.php.net/manage/user-notes.php