In the given tutorial we will study how to write the basic syntax of php:
<?php
?>
The above mentioned tag will be included in each php file and each php coding has to be written within this tag.
<?php
echo
"Hello World";?>
The above coding will print Hello World in the output screen or web page.
We can combine both php and html file in a single file, following example illustrates that:
Code:
<html>
<body>This is html portion<br/></body>
</html>
<?php
echo
"This is in php portion";?>
Output:
This is html portion
This is in php portion
php syntax is more or less similar to any other popular language like: C, ASP, Java etc. In this language semicolon is as important as other language. There are many more similarities are also present like in php white spaces don't make any special difference.
Example:
<?php
echo
"This
is
in
php
portion"
;?>
Output:
This is in php portion
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: php Basic Syntax View All Comments
Post your Comment