On Thu, Nov 28, 2002 at 10:19:38AM -0800, Mako Shark wrote:
> My problem is I need to loop through these. So I can't
> just assume that the count is count($issue[]) divided
> by 8, because that won't work in a for loop. I suppose
> I could just iterate through my for loop in jumps of
> 8, but that seems really hacky and unintuitive to
> whomever has to figure out my code when I'm gone.

By your description, count($issue)/count($issue[]) is the number of
real elements.  And a foreach loop will correctly step through whatever
array you pass to it, even if the values of that array are themselves
arrays.  Or could you try something like count(array_keys($issue)) ...
or the loop could be as simple as:

  $count=0; foreach($issue as $junk) $count++;

which is clear, though to my eye is the same as count();

I'm surprised that count($issue) would report something other than the
number of elements in $issue.  I never count my multidimensional arrays
so it's never come up for me.  :-/

  Paul Chvostek                                             <[EMAIL PROTECTED]>
  Operations / Abuse / Whatever                          +1 416 598-0000
  it.canada - hosting and development                  http://www.it.ca/

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

Reply via email to