strange problem with count()
| From: | Gunnar Beushausen | Date: | Sun, 29 Oct 2006 12:27:09 +0000 |
| Subject: | strange problem with count() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-243828@lists.php.net to get a copy of this message | ||
Hi!
I've a strange problem with count. I wrote a routine to jump to the last position of an array. The code ist this:
if(!$this->done) {
array_push($this->result, $this->stmt->fetchall_assoc());
}
$this->done = true;
$this->currIndex = $this->rowIndex = count($this->result)-1;
return $this;
If i do a print_r($this->result); i'm getting like thousand entries, so the array is actually filled with all values needed. But somehow a count($this->result) gives me a value of 1.
I wonder why count says there is only 1 entry in that array, when print_r gives out more than thousand entries. Does anybody have a clue? I'm using php 5.1.6
Thanks in advance,
Gunnar