When an array element is applied, Notice: Undefinedoffset appears.
Source: Internet
Author: User
Using the array element Notice: Undefinedoffset: $ file1 to open a file in this format: 1 | 23 | 4 | 123 | 1 & nbsp; $ line = fgets ($ file1 ); $ a_line = str_getcsv ($ line, & quot; | & qu use the array element to show Notice: Undefined offset:
$ File1 open a file in this format: 1 | 23 | 4 | 123 | 1
$ Line = fgets ($ file1 );
$ A_line = str_getcsv ($ line, "| ");
Print_r ($ a_line );
$ A_line [4] = $ a_line [4] + $ a_line [3]-1;
When I run $ a_line [4] and $ a_line [3], the following error occurs: Notice: Undefined offset :;
But the above print_r ($ a_line ); you can print the Array ([0] => 1 [1] => 23 [2] => 4 [3] => 123 [4] => 1)
I don't know why?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.