I have an array
$locations = [ 'name1', 'name2', 'name3', 'name4' ]
Now I want to create variables say $location1, $location2,...
which will hold value of name1, name2,.... respectively ( i.e., $location1 = 'name1', $location2 = 'name2',..... and so on
The array gets updated whenever admin adds new location so another variable must be created automatically to hold the name of new location from array.
Can it be done using php. Reason for this is I will need to access those variables and assign their values to javascript variable for displaying their name in map.
Any help would be appreciated.