I'm getting an undefined index notice, though the index is defined. PHP version is 5.6
Code:
$url = $_SERVER['REQUEST_URI'];
$array = explode('?', $url);
var_dump($array);
echo "<br>".$array[0]."<br>";
echo "this is value 1:".$array[1]."<br>"; //line 9
Output:
array(2) { [0]=> string(10) "/customers" [1]=> string(9) "name=test" }
/customers
this is value 1:name=test
This all makes sense, but I also get this notice:
PHP Notice: Undefined offset: 1 in /var/source/united/magebo/api/api.php on line 9
Any idea where this notice is coming from?
I tried setting the url hard coded to the same value, the notice disappears. I found allot of questions about this issue but in my case the index IS defined.