I want to store some data in an array called $temp, but I got an error that there is an undefined offset. Here's my code:
$temp = array();
$terms = $this->DocumentTerms();
$temp[0] = $terms[0][0];
for ($i = 0; $i < sizeof($terms); $i++) {
$flag = true;
for ($j = 0; $j < sizeof($terms[$i]); $j++) {
for ($k = 0; $k < sizeof($temp) || $k < sizeof($terms[$i]); $k++) {
if ($temp[$k] == $terms[$i][$j]) {
$flag = false;
break;
}
}
if ($flag)
array_push($temp, $terms[$i][$j]);
}
}
The undefined offset is at this part:
if($temp[$k] == $terms[$i][$j])
sizeof()vscount()?sizeof()is an alias ofcount(). They're exactly the same.