php-general | 2001072
Date: 07/31/01
- Next message: Alexander Wagner: "Re: Fwd: Re: [PHP] dumb mysql_connect issue"
- Previous message: Steve Wright: "[PHP] Visual Login"
- In reply to: Johnny Nguyen: "[PHP] Counting Multidimensional Arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Nevermind. I Found the solution. $m, $y, and $d must be cast to integers.
-----Original Message-----
From: Johnny Nguyen [mailto:johnny <email protected>]
Sent: Tuesday, July 31, 2001 3:58 PM
To: php-general <email protected>
Subject: [PHP] Counting Multidimensional Arrays
Given
////////////////////////////////////////////////////////////////////////////
//////////////
$Events[2001][07][31][0] = new ZEvent("Some Event 0", "Some Description 0",
"07-31-2001");
$Events[2001][07][31][1] = new ZEvent("Some Event 1", "Some Description 1",
"07-31-2001");
$Events[2001][07][31][2] = new ZEvent("Some Event 2", "Some Description 2",
"07-31-2001");
$Events[2001][08][01][0] = new ZEvent("Some Event 0", "Some Description 0",
"08-01-2001");
if I set.
$someclass->arrEvents = $Events;
and then inside of some class i say.
$m = 07;
$y = 2001;
$d = 31;
echo count($this->arrEvents[$y][$m][$d]);
Shouldn't I get 3 as my output? For some reason I am getting 0.
However, if I do:
foreach ($someclass->arrEvents[2001][07][31] as $someevent) {
echo $someevent->getName();
}
I get the correct output:
"Some Event 0Some Event 1Some Event 2"
Any ideas on how to get the correct count within someclass?
Regards,
Johnny Nguyen
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Alexander Wagner: "Re: Fwd: Re: [PHP] dumb mysql_connect issue"
- Previous message: Steve Wright: "[PHP] Visual Login"
- In reply to: Johnny Nguyen: "[PHP] Counting Multidimensional Arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

