note 32426 added to function.preg-split
| From: | chris at mad-teaparty dot com | Date: | Tue, 27 May 2003 14:57:00 +0000 |
| Subject: | note 32426 added to function.preg-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-49099@lists.php.net to get a copy of this message | ||
I normally use this to create a word index from any kind of text:
// e.g. we have a text in British English
setlocale(LC_ALL, "en_UK");
$words = preg_split("/[^[:alpha:]]+/", $text, -1, PREG_SPLIT_NO_EMPTY);
You may also walk through this array and erase all small and common words/auxiliaries (e.g.
"and", "while", "his", "them").
----
Manual Page -- http://www.php.net/manual/en/function.preg-split.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32426
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32426&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32426&report=yes