Basic Syntax PHP


Basic Syntax PHP
PHP code is executed on the server-side and the HTML tags for the result sent to the browser.

Basic Syntax PHP

Does PHP block always start with <?PHP and the end with ?>.PHP blocks will be placed anywhere in the document. PHP file just contains the HTML tags like HTML Files, some PHP scripting code.
Example of simple PHP code:
<html>
<body>
<?php
echo “Hello World”;
?>
</body>
</html>
Output: Hello World
Each line of code PHP end with a semicolon. the semicolon is used as a separator
There are two basic statements of the output:
1.Echo
2.print
The file must have been extension .php. HTML extension will not be executed in PHP.
PHP case sensitive
In PHP no keyword
If
Else
While
Echo etc.

PHP or Hypertext Preprocessor is a broadly utilized open-source universally useful scripting language and can be inserted with HTML. PHP records are spared with “.php” expansion. PHP contents can be composed anyplace in the record inside PHP follows alongside ordinary HTML.

PHP Tags or Escaping To PHP

The system of isolating an ordinary HTML from PHP code is known as the instrument of Escaping To PHP. There are different manners by which this should be possible. Hardly any strategies are as of now set of course however so as to utilize not many others like Short-open or ASP-style labels we have to change the arrangement of php.ini document. These labels are additionally utilized for inserting PHP inside HTML. There are 4 such labels accessible for this reason:-

Authoritative PHP Tags: The content beginnings with <. These labels are additionally called ‘Standard PHP labels’. Each PHP order closes with a semi-colon (;). How about we take a gander at the welcome world program in PHP:

Remarks in PHP

A remark is something that is disregarded and not read or executed by PHP motor or the language as a major aspect of a program and is composed to make the code more coherent and reasonable. These are utilized to support different clients and engineers to depict the code and what it is attempting to do. It can likewise be utilized in archiving a lot of code or part of a program. You more likely than not saw this in the above example programs.

PHP underpins two sorts of remark:

Single Line Comment: As the name proposes these are a single line or short significant clarifications that one can include their code. To include this, we have to start the line with (//) or (#).

Model:

Multi-line or Multiple line Comment: These are utilized to accommodate different lines with a solitary tag and can be exte

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

%d bloggers like this: