Re: PHP function for length of the array???

From: Date: Tue, 06 Jan 2004 22:38:10 +0000
Subject: Re: PHP function for length of the array???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173921@lists.php.net to get a copy of this message
--- Mike Migurski <mike@saturn5.com> wrote: > > Anyone know what is the php function for finding the length of the > > array? I haven't found the answer at > > http://us3.php.net/manual/en/ref.array.php . > > You are aware that all the available array functions are listed about > halfway down that page, right? To answer the original question, what do you mean by length? That's a bit ambiguous. So, I'll take a guess. If you mean the length of each element of the array, and it's a one-dimensional array, you can use a combination of implode() and strlen(): <? $foo[] = '1'; $foo[] = '22'; $foo[] = '333'; echo strlen(implode($foo)); ?> This outputs 6, the length of 122333. Hope that helps. Chris ===== Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/

« previous php.general (#173921) next »