Menu
×
×
Correct!

Exercise:

Create a switch statement that will output "Hello" if $color is "red", and "welcome" if $color is "green".

switch ($color) { case "red": echo "Hello"; break; case "green": echo "Welcome"; break; }

Not Correct

Click here to try again.

Correct!

Next ❯
 ($color) {
   "red":
    echo "Hello";
    break;
   "green":
    echo "Welcome";
    break;
}

  
  
  




Completed 0 of 47 Exercises:

PHP Syntax
PHP Variables
PHP Strings
PHP Operators
PHP If...Else
PHP Switch
PHP Loops
PHP Functions
PHP Arrays
PHP Forms
PHP Dates
PHP Advanced

×

Reset the Score?

This will reset the score of ALL 47 exercises.

Are you sure you want to continue?



×

Congratulations!

You have finished all 47 PHP exercises.

Share your score: