First Program in PHP | Syntax of PHP

Hello friends how are you? Today in this blog we will learn two basic elements of PHP in which first is Syntax of PHP and another is First program in PHP. First i am going to explain the syntax of PHP in which  i will include every single element which is used to create PHP program.

Let's Start

👉Syntax of PHP

<?php
//php code
?>

1.PHP starts with <?php and ends with ?> .
2.PHP code can be written anywhere in the php file.
3.The extension of PHP file is .php.
4.PHP file contains HTML,CSS,JAVASCRIPT,text and PHP code.

👉Hello World Program in PHP using echo

<?php
echo "Hello World";
?>

1.echo is used to display the text on to the output screen.
2.It can be used with parentheses or without parentheses.
<?php
echo "Hello World<br>";
echo ("Hello World<br>");
?>
/*
#output
Hello World
Hello World
*/

3.It can also print multiple string separated by comma simultaneously.
<?php
echo "Hello ","friends ";
?>
/*
#output
Hello friends
*/

4.It does not return any value.
5.echo is not case sensitive.
<?php
echo "Hello World<br>";
ECHO "Hello World<br>";
Echo "Hello World";
?>
/*
#output
Hello World
Hello World
Hello World
*/

👉Syntax of PHP
<?php
echo "Hello World";
?>

1.echo is used to display the text on to the output screen.
2.It can be used with parentheses or without parentheses.
3.It can also print multiple string separated by comma simultaneously.
4.It does not return any value.
5.echo is not case sensitive.

Request:-If you found this post helpful then let me know by your comment and share it with your friend. 

 
If you want to ask a question or want to suggest then type your question or suggestion in comment box so that we could do something new for you all. 

If you have not subscribed my website then please subscribe my website. Try to learn something new and teach something new to other. 

Thanks.

Post a Comment

0 Comments