The variable $words
concatenates the result of a query in a column of a table where the words are comma-separated.
Only when running the script for each word inside the for is generated a PHP Notice: Undefined index: agua in ....
If there are 50 words will be generated 50 PHP Notice: Undefined index: PALAVRA_DO_FOR in ...
$palavras = explode(',', $words);
$ocorrencias = array();
for($i = 0; $i<count($palavras); $i++){
$palavra = $palavras[$i];
$ocorrencias[$palavra]++;
}
How to avoid these PHP Notice: Undefined index: ...
?
PHP Version 5.4.43