Three Coding Problems That Will Test Your Limits

In this installment, we wanted to present some PHP coding problems and test to see whether you have the skills necessary to figure out a solution to the problems. For this very first installment of our coding problem, we’ve kept the problems easy or easier, just to get your feet wet. Try to work through the problems and let us know if you’re able to solve them!

Problem #1

Create a simple HTML form and accept the user name and display the name through PHP echo statement.

Problem #2

Write a PHP program to check if a given positive number is a multiple of 3 or a multiple of 7.

Problem #3

$ceu = array( “Italy”=>”Rome”, “Luxembourg”=>”Luxembourg”, “Belgium”=> “Brussels”, “Denmark”=>”Copenhagen”, “Finland”=>”Helsinki”, “France” => “Paris”, “Slovakia”=>”Bratislava”, “Slovenia”=>”Ljubljana”, “Germany” => “Berlin”, “Greece” => “Athens”, “Ireland”=>”Dublin”, “Netherlands”=>”Amsterdam”, “Portugal”=>”Lisbon”, “Spain”=>”Madrid”, “Sweden”=>”Stockholm”, “United Kingdom”=>”London”, “Cyprus”=>”Nicosia”, “Lithuania”=>”Vilnius”, “Czech Republic”=>”Prague”, “Estonia”=>”Tallin”, “Hungary”=>”Budapest”, “Latvia”=>”Riga”, “Malta”=>”Valetta”, “Austria” => “Vienna”, “Poland”=>”Warsaw”) ;

Create a PHP script which displays the capital and country name from the above array $ceu. Sort the list by the capital of the country.

Sample Output :
The capital of Netherlands is Amsterdam 
The capital of Greece is Athens 
The capital of Germany is Berlin 
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -

Tap here to see the answers

Affiliate Network Advertisement

Leave a Reply

Your email address will not be published. Required fields are marked *