PHP Associative Arrays


PHP Associative Arrays

Associative arrays have a key and a value. For example, the array below consists of the keys firstname, alstname and email while the values are Joe, Rogers and jo@example.com.

$my_array = array();
$my_array['firstname'] = 'Joe';
$my_array['lastname']  = "Rogers" ;
$my_array['email'] = 'joe@example.com';

echo $my_array['firstname']." ".$my_array['lastname'];