What do we mean by keys and values?

Technology CommunityCategory: PHPWhat do we mean by keys and values?
VietMX Staff asked 4 years ago

In associative arrays, we can use named keys that you assign to them. There are two ways to create an associative array:

// first way -

$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");`

// another method - 
$age['Peter'] = "35"; //Peter, Ben & Joe are keys
$age['Ben'] = "37"; //35, 37 & 43 are values
$age['Joe'] = "43";