kraadde Posted October 4, 2007 Share Posted October 4, 2007 I have following code: function chk( & $var ){ if ( !isset($var) ){ return NULL; }else{ return $var; } } chk($loop); ..... chk($y); $y = 0; while (($loop[$y]) != ''){ error here ?????????? ........ $y++; } ...... Does anybody know how to fix this? I can not figure out why there should be an undefined offset . HELP ME PLEASE! kraadde Quote Link to comment https://forums.phpfreaks.com/topic/71864-notice-undefined-offset-1-in/ Share on other sites More sharing options...
MmmVomit Posted October 4, 2007 Share Posted October 4, 2007 Change this while (($loop[$y]) != ''){ to this while (isset($loop[$y])){ Or you could just use a foreach loop. Quote Link to comment https://forums.phpfreaks.com/topic/71864-notice-undefined-offset-1-in/#findComment-361991 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.