phparrayssquare-bracketarray-population

What keys are generated when pushing an array element with empty square bracket syntax $array[]?


$a[]="Anna";
$a[]="Brittany";
$a[]="Cinderella";
$a[]="Diana";
$a[]="Eva";
$a[]="Fiona";
$a[]="Gunda";

When declaring it this way, does it automatically increase the index? Why is this ideal?


Solution

  • Yes it does. It may not be ideal for you, but it sure is convenient for most people.