EchoFool Posted July 16, 2008 Share Posted July 16, 2008 If there is an automated script which creates an array but there is no parametres that match to create this "array" is there a way to check that the array is in simple words... blank? Because at the moment after my while loop which creates the array i have: $_SESSION['MissionID'] = $a[0]; But if the array wasn't greated because all the rows have been used which can happen then obviously $a[0]; won't exist. So i end up with: Notice: Undefined offset: 0 in C:\xampp\htdocs\test.php on line 6431 So was wondering if there was a way to "check" if the array is blank and if it is then skip it. I tried this: <?php If($a[0]>0){ // do it }Else { // do not } Didn't work though. Any suggestions? But that didn't work. Link to comment https://forums.phpfreaks.com/topic/115103-help-with-checking-offset/ Share on other sites More sharing options...
rhodesa Posted July 16, 2008 Share Posted July 16, 2008 <?php if(is_array($a) && isset($a[0]) && $a[0]>0){ // do it }else { // do not } ?> Link to comment https://forums.phpfreaks.com/topic/115103-help-with-checking-offset/#findComment-591948 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.