Re: strange problem with count()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux