Re: strange problem with count()
| From: | Ed Lazor | Date: | Sun, 29 Oct 2006 17:43:24 +0000 |
| Subject: | Re: strange problem with count() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-243829@lists.php.net to get a copy of this message | ||
Side note, it sounds like
$this->result
is an object holding an array, not the array itself and print_r is automatically traversing the object.
On Oct 29, 2006, at 4:27 AM, Gunnar Beushausen wrote:
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 --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php