このコードで配列を抽出しようとしていますが、そのエラーが発生します。しかし、コードから while ブロックを削除し、インデックスのみを指定すると機能します。これがコードです。
//This function gives error: Notice: Undefined offset: 1 in .......
//but if i delete while block and only write print $type[$i]; it works.
public function checkMimeType(){
echo '<pre>';
$i = 0;
$type = array();
foreach($this->_sourceFile as $key){
$type= $key['type'];
}
while($i <= count($type))
{
print $type[$i].'<br>';
$i++;
}
}