I have written a script to grab the most common words in a page (with tags stripped etc.) It mostly works, however there is an occasional occurrence of the following happening: helloThisIsAnExampleOfTheA
This occurs while grabbing certain HTML via a cURL based function, stripping tags and counting word frequency. It mostly appears to occur in menus and widgets.
What I'm looking for is an elegant/efficient solution to pop/push/unset values in the array with the values split.
preg_replace('/(?<! )(?<!^)[A-Z]/',' $0', $words)
I'm using the above regular expressions to essentially split the values based on uppercase values occurring mid string/array element.
$array is currently something like this: ("This", "is", "okay", "this", "IsNotOkay")
What I want:
$array is going to look something like this ("This", "is", "okay", "this", "Is", "Not", "Okay")
Don't worry too much about the repeat values as I am utilising a "stop words" array to rid the ones I would not like to keep.
I've not got it working nicely yet so thought I'd turn to you for your expert input.
Thanks in advance.