Do you name your arrays using plural or singular in PHP? [closed]

When I'm naming array-type variables, I often am confronted with a dilemma: Do I name my array using plural or singular?

For example, let's say I have an array of names: In PHP I would say: $names=array("Alice","Bobby","Charles");

However, then lets say I want to reference a name in this array. For Bobby, I'd say: $names[1]. However, this seams counter-intuitive. I'd rather call Bobby $name[1], because Bobby is only one name.

So, you can see a slight discrepancy. Are there conventions for naming arrays?


I use the plural form. Then I can do something like:

$name = $names[1];

Name should always convey as much information as possible in case a reader is not familiar with the type declaration. An array or collection should therefore be named in the plural.

I personally find $name[1] to be misleading, since it means "the 1st element of name" which doesn't make English sense.


I usually give it something on the end like list so it would be

nameList

Otherwise, I make it plural.