Reputation: 3215
// I am working on matching the individual words from array $frequency // to the search results from that individual word.
I don't know why this does not work
for ($i = 1; $i <= ($frequency); $i++) {
echo $i;
echo getphp_AlexVortaro ($frequency[$i]);
echo getphp_Smartfm($frequency[$i]);
print_r($frequency[$i]);
}
I get
Notice: Undefined offset: 11 in /Users/briancarpenter/Sites/Vortoj/countplus.php
on line 21
X A lot
Upvotes: 0
Views: 186
Reputation: 992
PHP array subscripts start at 0, not 1. You want your loop to be
for ($i = 0; $i < count($frequency); $i++) { ...
Upvotes: 3
Reputation: 361565
Two things: (1) Arrays are 0-based, not 1-based. (2) Your conditional needs to use the count() function.
for ($i = 0; $i < count($frequency); $i++)
Upvotes: 1