note 62344 added to function.substr
| From: | christian dot wessels at web dot de | Date: | Sat, 25 Feb 2006 19:25:57 +0000 |
| Subject: | note 62344 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104431@lists.php.net to get a copy of this message | ||
When using substr() or strpos() with large strings you shouldn't forget to pass them by
reference else PHP copies the string and allocates memory (and frees it again) for the string which
is pretty slow.
I've written some code to unserialize a 564kByte array from a damaged file.
When used with references it runs within 6s through the file, without passing by reference it needed
21minutes ;)
----
Server IP: 217.13.201.10
Probable Submitter: 87.123.169.10
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- http://master.php.net/note/edit/62344
Del: integrated -- http://master.php.net/note/delete/62344/integrated
Del: useless -- http://master.php.net/note/delete/62344/useless
Del: bad code -- http://master.php.net/note/delete/62344/bad+code
Del: spam -- http://master.php.net/note/delete/62344/spam
Del: non-english -- http://master.php.net/note/delete/62344/non-english
Del: in docs -- http://master.php.net/note/delete/62344/in+docs
Reject -- http://master.php.net/reject/62344&report=yes
Search -- http://master.php.net/manage/user-notes.php