15
4
|
I am getting this PHP error:
Here is the PHP code that throws it:
What does this error mean? What causes this error?
| |||
28
|
change
to
or simply:
Not every line of your file has a colon in it and therefore explode on it returns an array of size 1.
According to php.net possible return values from explode:
"Returns an array of strings created by splitting the string parameter on boundaries formed by the delimiter." "If delimiter is an empty string (""), explode() will return FALSE. If delimiter contains a value that is not contained in string and a negative limit is used, then an empty array will be returned, otherwise an array containing string will be returned." |
var_dump($parts)
. you'll probably find that the point you get that undefined offset, there is no1
key in the parts array. – Marc B Jul 3 '13 at 19:16count($parts)
. – Barmar Jul 3 '13 at 19:18