cvs: pear /PHP_Compat/Compat/Function str_word_count.php
| From: | Aidan Lister | Date: | Sat, 26 Jun 2004 07:28:07 +0000 |
| Subject: | cvs: pear /PHP_Compat/Compat/Function str_word_count.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21141@lists.php.net to get a copy of this message | ||
aidan Sat Jun 26 03:28:07 2004 EDT
Modified files:
/pear/PHP_Compat/Compat/Function str_word_count.php
Log:
Fixed variable names
http://cvs.php.net/diff.php/pear/PHP_Compat/Compat/Function/str_word_count.php?r1=1.2&r2=1.3&ty=u
Index: pear/PHP_Compat/Compat/Function/str_word_count.php
diff -u pear/PHP_Compat/Compat/Function/str_word_count.php:1.2
pear/PHP_Compat/Compat/Function/str_word_count.php:1.3
--- pear/PHP_Compat/Compat/Function/str_word_count.php:1.2 Sat Jun 26 03:21:26 2004
+++ pear/PHP_Compat/Compat/Function/str_word_count.php Sat Jun 26 03:28:07 2004
@@ -16,7 +16,7 @@
// | Authors: Aidan Lister <aidan@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: str_word_count.php,v 1.2 2004/06/26 07:21:26 aidan Exp $
+// $Id: str_word_count.php,v 1.3 2004/06/26 07:28:07 aidan Exp $
//
@@ -27,7 +27,7 @@
* @package PHP_Compat
* @link http://php.net/str_word_count
* @author Aidan Lister <aidan@php.net>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @since PHP 4.3.0
* @require PHP 4.0.1 (trigger_error)
*/
@@ -41,7 +41,7 @@
}
$word_string = preg_replace('/[0-9]+/', '', $string);
- $word_array = preg_split('/[^A-Za-z0-9_\']+/', $wordstr, -1,
PREG_SPLIT_NO_EMPTY);
+ $word_array = preg_split('/[^A-Za-z0-9_\']+/', $word_string, -1,
PREG_SPLIT_NO_EMPTY);
switch ($format):
case null:
@@ -54,10 +54,11 @@
case 2:
$lastmatch = 0;
+ $word_assoc = array();
foreach ($word_array as $word) {
- $array[$lastmatch = strpos($string, $word, $lastmatch)] = $word;
+ $word_assoc[$lastmatch = strpos($string, $word, $lastmatch)] = $word;
}
- return $array;
+ return $word_assoc;
break;
endswitch;