I am working on a project where I have to find out the keyword density of thepage on the basis of URL of that page. I googled a lot but no help and scripts were found, I fou
If the given keyword is "elephant walks", the keyword density would be how often the term "elephant walks" appears on any given web page in relation to other text. As VirtuosiMedia said, this is (broadly) useless information.
To measure it, you must strip all mark up from the text, count the words while keeping track of how often the keyword(s) appear.
At that point, you will know, xx.xx % of all words in this text are keywords. xx.xx % of the time , the key word(s) are used next to each other, therefore my keyword density for "elephant walks" is xx
Again, the only reason this is useful is to demonstrate pattern matching and string functions in php.