Notice: Undefined offset: 0 in

后端 未结 14 1612
太阳男子
太阳男子 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:20

    its just a warning use:

    error_reporting(0);
    

    it shows when we do not initialize array and direct assigning value to indexes.

    somefunction{
    $raja[0]="this";
    $raja[1]="that";
    }
    

    instead :

    somefunction{
    $raja=array(0=>'this',1='that');
    //or
    $raja=array("this","that");
    }
    

    it just notification, do not generate any output error or any unexpected output.

提交回复
热议问题