Answer» | Associative Arrays | Indexed or Numeric Arrays |
|---|
| This is a type of arrays which used named specific KEYS to assign and store values in the database. | This type of arrays store and assign values in a numeric fashion with count STARTING from zero. | Example Example of an associative array:
$name_two["i am"] = "zara";
$name_two["anthony is"] = "Hello";
$name_two["ram is"] = "Ananya";
echo "Accessing elements directly:\n";
echo $name_two["i am"], "\n";
echo $name_two["anthony is"], "\n";
echo $name_one["Ram is"], "\n";
Output:
Accessing elements directly:
zara
Hello
Ananya
Example of an indexed or numeric array:
$name_two[1] = "SONU Singh";
echo "Accessing the array elements directly:\n";
echo $name_two[1], "\n";
Output:
Sonu Singh
|