Array Types in PHP
The are 3 types of Arrays in PHP : Numeric Array, Associative Array and Multidimensional Array.
<?php

//Numeric Arrays

    $names = array("Mate", "Giorgi", "Davit");
    echo $names[1] . "\n"; 
    
    $names[0] = "Mate";
    $names[1] = "Giorgi";
    $names[2] = "Davit";
    
// Associative Arrays

$people = array("Mate"=>"30", "Giorgi"=>"32", "Davit"=>"36");
// or
echo $people['Mate'] = "30" . "\n";
echo $people['Giorgi'] = "32" . "\n";
echo $people['Davit'] = "36" . "\n";

//Multi-Dimensional Arrays

$PEOPLE = array (
    'Women' => array('Natalia', 'Elena', 'Inga'),
    'Men' => array('Mate', 'Giorgi', 'Zura'),
    'Kids' => array('Nia', 'Sofia', 'Rezi')
    );
    
echo $PEOPLE['Kids'][0] . "\n"; 
echo $PEOPLE['Men'][2] . "\n";
echo $PEOPLE['Women'][1];

?>
by Elena Kuparadze
2 years ago
PHP
Arrays
0
Pro tip: use ```triple backticks around text``` to write in code fences