Basic Syntax of PHP: Getting Started with PHP Programming

Rumman Ansari   Software Engineer   2024-07-09 10:01:44   5644  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

You can run PHP code on any web browser. The PHP script is executed on the server, and the plain HTML result is sent back to the browser.

Basic Syntax of PHP

  • PHP code is start with  <?php  and ends with  ?>
  • Every PHP statements end with a semicolon (;).
  • PHP code save with .php extension.
  • PHP contains some HTML tag and PHP code.
  • You can place PHP code anywhere in your document.

PHP Syntax



<?php
// PHP code goes here
?>


PHP files save with .php extension and it contain some HTML and PHP code.


<!DOCTYPE html>
<html>
<body>

<h1>This is my first PHP code</h1>

<?php
echo "Hello World!";
?>

</body>
</html>


Output

	
This is my first PHP code