Write a program to print two variables in single echo

Description:
Write a program to print 2 php variables using single echo statement.

Conditions:

  • First variable have text “Good Morning.”
  • Second variable have text “Have a nice day!”
  • Your output should be “Good morning. Have a nice day!”
  • You are allowed to use only one echo statement in this program.

View Solution/Program

<?php
$message_1 = "Good Morning.";
$message_2 = "Have a nice day!";
echo $message_1." ". $message_2;
?>
Tutorials Class - Output Window

Good Morning. Have a nice day!


Learn more about the similar topics:
Tutorials
PHP Variables
Exercises & Assignments
Write a program to print “Hello World” using echo
Write a program to print “Hello PHP” using variable
Write a program to print a string using echo+variable.
Write a program to print two variables in single echo
Interview Questions & Answers
Is PHP a case sensitive language?
What are the different data types in PHP?