note 56410 added to function.trim

From: Date: Thu, 01 Sep 2005 18:30:57 +0000
Subject: note 56410 added to function.trim
Groups: php.notes 
Request: Send a blank email to php-notes+get-94616@lists.php.net to get a copy of this message
Just a word of caution when looping through a batch of strings (in the thousands or more). Using trim to take off a left over character (like a comma in a csv output) will result in a much slower execution. It is better to use a tiny bit of conditional logic instead. I believe the reason this is the case is because of having to create a new spot in memory to temporarily handle the result of trim. Hope this helps. ---- Manual Page -- http://www.php.net/manual/en/function.trim.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56410 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56410&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56410&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56410&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56410&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56410&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56410&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56410&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94616) next »