note 104138 added to language.oop5.magic
| From: | Wesley at osu1 dot php dot net | Date: | Wed, 25 May 2011 19:10:40 +0000 |
| Subject: | note 104138 added to language.oop5.magic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180037@lists.php.net to get a copy of this message | ||
Warning __toString can be triggerd more then one time
if(strstr(substr($obj,0,1024), 'somestuff')
echo $obj;
return 'missing somestuff at the start, create container!';
substr() will trigger a __toString aswell as echo $obj;
wich cause a performance issue since it will gather all data twice.
what i used as a hotfix:
__toString(){
if(null === $this->sToString)
$this->sToString = $this->_show();
return $this->sToString;
}
----
Server IP: 69.147.83.197
Probable Submitter: 87.211.67.92
----
Manual Page -- http://www.php.net/manual/en/language.oop5.magic.php
Edit -- https://master.php.net/note/edit/104138
Del: integrated -- https://master.php.net/note/delete/104138/integrated
Del: useless -- https://master.php.net/note/delete/104138/useless
Del: bad code -- https://master.php.net/note/delete/104138/bad+code
Del: spam -- https://master.php.net/note/delete/104138/spam
Del: non-english -- https://master.php.net/note/delete/104138/non-english
Del: in docs -- https://master.php.net/note/delete/104138/in+docs
Del: other reasons-- https://master.php.net/note/delete/104138
Reject -- https://master.php.net/note/reject/104138
Search -- https://master.php.net/manage/user-notes.php