at the moment I do something like this
exec($command, $retval);
The response is normally an array, which has either the value success or failure. At the moment, I am doing something like the following
if($retval[0] === 'success') {
//do something else
} else {
//handle the error
}
I have noticed though that sometimes, I see an error in the console which states
Undefined offset: 0 in
I presume that sometimes something is happening and an array is not returned. It is executing a Python script.
Is there any way I can handle if the offset is 0? I would have presumed this would have been handled in the else clause, but apparently not.
Thanks
if(isset($retval[0]) && $retval[0] === 'success') { do what ever you want }