Sunday, July 23, 2017

PHP Syntax



PHP is a server side scripting language, So PHP script is executed on the server when user load the webpage and return the result back to browser as a plain HTML.




Before writing the php script we need to remember the below few things:

1. A PHP script can be placed anywhere in the document.
2. A PHP script starts with <?php and ends with ?> .
3. To see the result of php code in browser, you need to save the file consists of php code as ".php" extension. eg. [Demo.php]
4. PHP statements end with a semicolon (;).

Demo.php

<?php
// write the PHP code goes here
?>

PHP file consists of HTML tags and php scripts. Look below for sample PHP code :

<!DOCTYPE html>
<html>
<body>

<h1>Welcome to first PHP page</h1>

<?php
echo "Hello Skptricks";
?>

</body>
</html>





No comments:

Post a Comment