[Solved] Town Info - PHP Task

  

3
Topic starter

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".

Examples:

town info php task

1 Answer
2

My solution:

<?php
 
$town = readline();
$population = readline();
$area = readline();
 
echo "Town $town has population of $population and area $area square km.";
Share: