note 35409 added to function.strpos
| From: | daijoubu at videotron dot ca | Date: | Sat, 30 Aug 2003 09:48:20 +0000 |
| Subject: | note 35409 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55333@lists.php.net to get a copy of this message | ||
To previous comments:
I did a test with 500000 iterations, string lenght was 1846bytes long and the word to find was near
the end.
Results:
if (*)
Total time in secs
Average
strpos($test, 'Possibly') === true
5.1114
0.0000102228
strpos(' '.$test, 'Possibly') > 1
7.2559
0.0000145117
is_int(strpos($test, 'Possibly'))
5.5331
0.0000110661
strstr($test, 'Possibly')
5.1461
0.0000102922
Clearly shows that === operator is the fastest
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35409
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35409&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35409&report=yes