I want to add the locality name from a google maps html call(below) to a specific php variable so that I can 1) store it in a mysql database and 2) display it as part of an echo statement (echo $locality).

The array of each location has 3 keys: long_name , short_name and types.
Types is an array , so , if there's a value of "locality" in that types array
get the long_name of that location and store it.

EDIT: This function will store all the long_names of location which has a locality type,
not just the first one.
In order to get only the first location's long_name ,add "break" after the $locality[] = ....