php

Hello World in PHP

The echo function can be used to output strings in PHP. If a variable is passed to this function, it outputs this variable. If a string is passed to it instead, echo displays it as long as it is enclosed in single or double-quotes. The following example shows a script that is nothing more than “Hello World!”. Both single and double quotation marks are used once.
 

Example :
<?php
    echo("Hello World!");
    echo('Hello World!');
?>

Output:

Hello World!Hello World!

 

 
A line break is not visible because none was passed to the echo function. The following code is the same as the above code, but this time with a line break:

<?php
    echo("Hello World!\n");
    echo('Hello World!');
?>

Output:

Hello World!
Hello World!
PHP MCQ - Multiple Choice Questions and AnswersPHP MCQ – Multiple Choice Questions and Answers – Basics – Part 1This collection of PHP Multiple Choice Questions and Answers (MCQs): Quizzes & Practice Tests with Answer focuses on “PHP basic”.   1. In PHP, variables…Read More mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

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