PHP 7 Fundamental Tutorial for Beginners – PHP Syntax

Standard PHP Syntax

One of the first scripts is run on the server, and the simple result results are sent back to the browser.

Basic PHP Syntax

one PHP script starts with the .
A print file always contains a html tag and some print script code

In the following example, instead of Simple Hatmall, only the first file has an example in which
The first is a script that shows the code “hello world” that uses the “echo” function code in the code.
On a web page.

Example

Every PHP statement end with a semicolon (;) — this tells the PHP engine that the end of the current statement has been reached.

Embedding PHP within HTML

The first file is a simple file with the .oh extension. Inside a first file we can write html code Like we do in the html file, and also on the server side we can show the first code as we have given below.

Example

As in the example given above, we have told you to PHP the code inside the HTML
How to combine code to create a dynamic web page created in a simple way. If the results show the code on the path of the web page, then the difference that you will see is the first code <! First echo “Hello, World!” | The ” replaced with the output “Hello, world!”.

when you run this code the PHP engine executed the instructions between the tags and leave the rest of the thing as it is. At the end, the webserver send the final output back to your browser which is completely in HTML.

PHP Comments

A comment is a code in which PHP ignores files. The commenting command makes the code more attractive.Or it is easy to explain to the other developer what the code is coded
(Or when we look at the first code in the future, we can easily find out what has happened or not)

PHP support single-line as well as multi-line comments. To write a single-line comment either start the line with either two slashes (//) or a hash symbol (#). For example:

Example

Currently slash followed bean asterisk (/ ) at the beginning of a comment to write with a multi-line comment. Asterisk followed by a slash ( /) at the end of the comment and comment. Are being given

Example

Case Sensitivity in PHP

In PHP, keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are not case-sensitive.

In the example below, all three echo statements below are equal and legal:

Example

Variable names in PHP are case-sensitive. As a result the variables $color, $Color and $COLOR are treated as three different variables.

Example

If you try to run the above example code it will only display the value of the variable $color and produce the “Undefined variable” warning for the variable $Color and $COLOR.

However the keywords, function and classes names are case-insensitive. As a result calling the gettype() or GETTYPE() produce the same result.

Example

If you try to run the above example code both the functions gettype() and GETTYPE() gives the same output, which is: string.

Rajesh Kumar
Follow me