Re: I should know this by now (?)
| From: | Aziz Saleh | Date: | Sat, 25 Jun 2022 03:14:41 +0000 |
| Subject: | Re: I should know this by now (?) | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-328019@lists.php.net to get a copy of this message | ||
On Fri, Jun 24, 2022 at 11:02 PM <paulf@quillandmouse.com> wrote:
> On Fri, 24 Jun 2022 17:20:42 -0700
> JEFFRY KILLEN <jekillen@prodigy.net> wrote:
>
> > Hello:
> >
> > Are associative arrays countable?
> >
> > I am trying to process the number of indexes in
> > an associative array and am having a real struggle
> > getting a proper comparison to an incremented numerical
> > variable.
> >
> > I have looked at the manual entry for count() and that is
> > what is sparking the question because I do not see that
> > associative arrays are explicitly countable.
> >
> > Thank you for time and attention
> > JK
>
> I don't recall ever having a problem using count() against associative
> arrays. Try it.
>
> Paul
>
> --
> Paul M. Foster
> Personal Blog: http://noferblatz.com
> Company Site: http://quillandmouse.com
> Software Projects: https://gitlab.com/paulmfoster
count() works for any array or a countable object. For a full definition of
what are arrays in PHP check this:
https://www.php.net/manual/en/language.types.array.php