Re: [PHP] twodimensional array / word-frequencylist

2003-06-26 Thread David Otton
On Thu, 26 Jun 2003 13:25:39 +0200, you wrote: ># i would like a similar function that removes interpuntuation like "." etc. ># all i want remaining in the array are the separate words, all in lower >case How do you define a word? Is a hyphen part of a word? Do you want to strip out numbers? Make

RE: [PHP] twodimensional array / word-frequencylist

2003-06-26 Thread Naintara Jain
, June 26, 2003 4:56 PM To: [EMAIL PROTECTED] Subject: [PHP] twodimensional array / word-frequencylist Hi, I asked the same question two days ago, but i have not received an answer that could really help me on my way... So i'll try again, this time with the help of a little PHP code, and

Re: [PHP] twodimensional array / word-frequencylist

2003-06-26 Thread David Nicholson
Hello, This is a reply to an e-mail that you wrote on Thu, 26 Jun 2003 at 12:36, lines prefixed by '>' were originally written by you. > foreach($words as $thisword){ > if(in_array($thisword, $array)){ > $array[$thisword]++; > } else { > $array[$thisword]=1; > } Just

Re: [PHP] twodimensional array / word-frequencylist

2003-06-26 Thread David Nicholson
Hello, This is a reply to an e-mail that you wrote on Thu, 26 Jun 2003 at 12:26, lines prefixed by '>' were originally written by you. > # i would like a similar function that removes interpuntuation like > "." etc. > # all i want remaining in the array are the separate words, all in > lower > ca

Re: [PHP] twodimensional array / word-frequencylist

2003-06-26 Thread Chris Hayes
if (!isset($words[$word] $words[$word]=0; else $words[$word]++; } change the 0 to 1 of course. Anyway the function Jason suggested is probably faster. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] twodimensional array / word-frequencylist

2003-06-26 Thread Chris Hayes
There may be faster ways, for instance using the regular expression function that returns an array of hits, and make the regexp look for 'words' in it with the \b option. But i will stick to your example code. My suggestions are not tested. while($myrow = mysql_fetch_row($result)) # as long as t

Re: [PHP] twodimensional array / word-frequencylist

2003-06-26 Thread Jason Wong
On Thursday 26 June 2003 19:25, Dore van Hoorn wrote: [snip] > # i would like a function that pushes this word into a second array. > # before pushing, it has to check whether or not the same word is already > in the array. > # if it is: do not push word into array, but add "1" to the number of >

[PHP] twodimensional array / word-frequencylist

2003-06-26 Thread Dore van Hoorn
Hi, I asked the same question two days ago, but i have not received an answer that could really help me on my way... So i'll try again, this time with the help of a little PHP code, and soms explanations while($myrow = mysql_fetch_row($result)) # as long as there are texts in the database {