By using our mini forum, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy

Q: Town Info - PHP Task

+3 votes

You will be given 3 lines of input. On the first line you will be given the name of the town, on the second – the population and on the third the area. Use the correct data types and print the result in the following format:

"Town {town name} has population of {population} and area {area} square km".


town info php task

asked in PHP category by user john7

1 Answer

+2 votes

My solution:


$town = readline();
$population = readline();
$area = readline();

echo "Town $town has population of $population and area $area square km.";
answered by user Jolie Ann