Hey, welcome to zhullyblog. If this is your first time here , please
Subscribe to Zhullyblog by Email to get latest tutorial.
PHP Syntax
PHP codes are embedded within the HTML tags.
PHP script starts with the
<?php and ends with the
?> tag.
<?php
echo "Hello, world!";
?>
This tells the computer or the editor that the code that will be within the
<?php and ?> are PHP code.
The PHP code ends with a semicolon (;). The semicolon denotes the end of a statement.
Note: PHP script are saved as .php extension.
PHP works hand in hand with HTML so it can be embedded within an HTML document.
PHP file can be embedded within HTML file and the normal syntax will follow and also HTML file can be embedded within PHP file also.
The code below shows how to embed PHP code in HTML. The code when displayed on the browser will display Hello World. You can embed the PHP script anywhere within your HTML document.
Let’s break it down
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>A Simple PHP Example</title>
</head>
<body>
<h1><?php echo "Hello, world!"; ?></h1>
</body>
</html>
When you have the above code on your HTML editor and you run it, the code will execute the HTML and interpret the word within the <?php ….?> tag and it will print Hello World in complete HTML format.
Please share
OTHER TUTORIALS
3) PHP Comment
4) PHP Data types
5) PHP Variables
6) PHP Echo and Print - How to display output
7) PHP If, if else and if elseif statement
8) PHP Lopps - While , Do while
9) PHP Strings : How to create and manipulate Strings
10) PHP Arrays
11)PHP FORMS: How to create a form, access data submitted in the form by user
Follow us on
Comments
Post a Comment