Notice: Undefined offset: 0 in

后端 未结 14 1614
太阳男子
太阳男子 2020-11-28 11:05

I am getting this PHP error, what does it mean?

Notice: Undefined offset: 0 in 
C:\\xampp\\htdocs\\mywebsite\\reddit_vote_tut\\src\\votes.php on line 41
         


        
14条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 11:37

    This answer helped me https://stackoverflow.com/a/18880670/1821607 The reason of crush — index 0 wasn't set. Simple $array = $array + array(null) did the trick. Or you should check whether array element on index 0 is set via isset($array[0]). The second variant is the best approach for me.

提交回复
热议问题