PHP Notice: Undefined offset: 1 with array when reading data

前端 未结 10 1526
遇见更好的自我
遇见更好的自我 2020-12-04 15:14

I am getting this PHP error:

PHP Notice:  Undefined offset: 1

Here is the PHP code that throws it:

$file_handle = fopen($pa         


        
10条回答
  •  佛祖请我去吃肉
    2020-12-04 15:56

    Update in 2020 in Php7:

    there is a better way to do this using the Null coalescing operator by just doing the following:

    $data[$parts[0]] = $parts[1] ?? null;
    

提交回复
热议问题