Undefined offset while accessing array element which exists

后端 未结 7 1262
日久生厌
日久生厌 2020-12-15 04:03

I have an array and PHP and when I print it out I can see the values I need to access, but when I try accessing them by their key I am getting a PHP Notice. I printed the ar

7条回答
  •  囚心锁ツ
    2020-12-15 04:31

    I've just found this bug which causes array elements to be inaccessible sometimes in PHP when the array is created by a call to unserialize.

    Create a test PHP file containing (or run from the command line) the following script:

     $v) 
    { 
      print 'KEY: '; 
      var_dump($k); 
      print 'VAL: '; 
      var_dump($v); 
      print "\n"; 
    }
    

    If you get errors you have a version of PHP with this bug in it and I recommend upgrading to PHP 5.3

提交回复
热议问题