Syntax Of PHP With Examples & Use

Basic Syntax Of PHP Development With Example
\\ If you have any query or questions on my post, then please comment below //

PHP Syntax:  


<?php  
// Write PHP code here.
?> 

PHP code starts with <?php and end with ?>, and in between these tags you can write the code, whatever you want to do. 
For Example Of PHP: Write a simple program in php to print a message "Technical Programming", "Campus Nikalo", "Amit Kumar Gupta" & "Web Developer".
Lear How To Write Program In PHP.
Step 1: Open Macromedia Dreamweaver or notepad++.
Step 2: Write the below program.
-----------------------------------------------------------------
<?php
echo"Technical Programming";
echo"Campus Nikalo";
echo"Amit Kumar Gupta";
echo"Web Developer";
?>
------------------------------------------------------------------- 
Step 3: And save file with name "test.php" to this location "xampp/htdocs/test.php". I saved my php program to location "C:\xampp\htdocs\Technical Programming Site\test.php". Here inside htdocs folder I created my own folder "TechnicalProgrammingSite", you also create your own folder.
 
Step 4: Open any browser and type "localhost" and then it will show you xampp server, and url showing localhost/xampp so here you remove xampp and type "localhost/YOURFOLDERNAME/test.php" and then click enter. For example I enter here"localhost/TechnicalProgrammingSite/ and press enter". So it display me list with name of php program, that  I was already created in that folder.

Step 5: Then choose your php program and press that program page. And for this program It will show you the message, you had written in program code.

Output Of This Program:

Explanation Of Above PHP Code: 
<?php & ?> is the php code, and echo is used to print message. Here all message are printed in single line, because we had not break the line. For breaking line we can use <br> tag after all the message lines.
Learn Use Of <br> tag In PHP:
Now If i use the <br> tag then my program looks like:
-----------------------------------------------------
<?php
echo"Technical Programming";
echo "<br>";
echo"Campus Nikalo";
echo "<br>";
echo"Amit Kumar Gupta";
echo "<br>";
echo"Web Developer";
?>

--------------------------------------------------
Now you see our output looks like this:

Here you see our output should be in line by line with the help of <br> tag. Now I hope you understand how to use br tag in php.

Now I hope you learn these things in this post:
1. How to write program in PHP.
2. Basic Syntax Of PHP Development.
3. Use Of PHP Syntax.
4. Use Of br tag.
5. Why echo is used in PHP.
6. Use Of echo in php with example.
7. How to run php program.
8. How to write code in PHP.


If you have any query then please comment below, I will try to solve your query within 24 Hours.





 Enter Your Email Id To Get Our Programming, Web Development, Video Tutorial, Job Updates In Mail :

Labels: