Question: Read a file called populations.txt and populate a php associative array with the values read from the file. Here is an example populations.txt file: Dhaka,
Read a file called populations.txt and populate a php associative array with the values read from the file.
Here is an example populations.txt file:
Dhaka, 23 million
Bangaluru, 21 million
New York, 9 million
Emporia, 23 thousand
Here's some pseudo code:
open the file
loop through the lines in the file
read a line into a string variable
explode (or is it split, or something else) the string into key value pairs
save the key value pair into your associative array
print a table header
loop through the keys of your associative array
print each key value pair
Then move the file and write to another file and read that file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
