i process input of users.
input should have format:
text. address: xyz
now tried use:
$address = explode('address: ', $text)[1];
but causes error in case of user input doesn't match needed format.
how prevent (maybe including check), script won't trigger notice?
first assign variable:
$address = explode("address: ", $text);
then check if set key 1
:
if (isset($address[1]) { $address = $address[1]; }
then shouldn't have notices because next time you'll existing parameter in array.
Comments
Post a Comment