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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started