I have a code like this:
// load the file
self::$_list = array();
$handle = fopen($file, 'r');
while (!feof($handle)) {
$line = fgetcsv($handle);
if (null != $line && count($line)!=2) continue;
self::$_list[trim($line[0])] = trim($line[1]);
}
fclose($handle);
But when I test, I got an error like this:
Notice: Trying to access array offset on value of type bool in
The error refers to the script self::$_list[trim($line[0])] = trim($line[1]);.