0% found this document useful (0 votes)
17 views

PHP Syntax Made Easy

PHP syntax is similar to C/C++ and Java, with script executed on the server and inserted into HTML using opening <?php and closing ?> tags. A basic "Hello World" PHP file displays this text between the tags embedded in an HTML document. Semicolons terminate individual lines of PHP code.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

PHP Syntax Made Easy

PHP syntax is similar to C/C++ and Java, with script executed on the server and inserted into HTML using opening <?php and closing ?> tags. A basic "Hello World" PHP file displays this text between the tags embedded in an HTML document. Semicolons terminate individual lines of PHP code.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

PHP Syntax

If you came from other programming languages like c/c++ and or Java, you will not have
difficulty understanding PHP syntax as they have the same thing in common.
But unlike c/c++ or Java, PHP script is executed on the server and can be inserted within any
HTML code and must start scripting block with <?php and end with ?>.
Below is an example of PHP file:
1.
2.
3.
4.
5.
6.
7.

<html>
<body>
<?php
echo "Hello World";
?>
</body>
</html>

As you can see the Hello World is within the scripting block of <?php and ?>. If you
sometimes see a block that starts with <? and end with ?>, this means that the shorthand support
is enabled in the server.
But for compatibility, use the standard form (<?php).
At the end of the echo command there is a semicolon (;). This means that it is a separator used to
separate its line of code from other line.
As of now this is the basic syntax of PHP. As we go on we will teach you on how to create PHP
script one by one.

You might also like