Re: Undefined offset

From: Date: Mon, 01 Mar 2004 16:10:58 +0000
Subject: Re: Undefined offset
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-179177@lists.php.net to get a copy of this message
I had read elsewhere on this list that it could be the case that $this->inputs[$i] wasn't defined at $i. That is why I encased the for loop in the if condition:
      if (sizeof($this->inputs) > 0)
      {
         for($i=0; $i <= sizeof($this->inputs); $i++)
         {
..... I've used both the 'sizeof' functions and 'count' On Mar 1, 2004, at 10:03 AM, Stuart wrote:
Jough P wrote:
Greetings all, I'm getting "Notice: Undefined offset" regarding this line of code while inside a for loop: if($this->inputs[$i] == "user") I assume the 'offset' that is undefined is $i. But $i is defined is the for statement above it.
It doesn't mean that $i isn't defined. It means that $this->inputs[$i] isn't defined for the value of $i where the notice is generated. -- Stuart


« previous php.general (#179177) next »