Php – Syntax Overview – POFTUT

Php – Syntax Overview

[rps-include post=6522]

Extension

Php source or code files generally ends with .php but generally the extension is not important. Following extensions can be used too.

  • php4
  • php5
  • php7

Php Tags

Web based programming languages generally uses tags in order to surround related code. Php is web based programming language too and uses <?php ... ?> tags. Second tag is not compulsory if the code ends without different language but makes the code more elegant .

Below we can see new code here.

Semicolons

Php is C and C++ centric language and uses semicolons to specify end of statement. Each semicolon end the line or statement like below.

There is another usage of semicolons too. We can use multiple semicolons for multiple statements like below.

Comments

While developing applications we generally need to take notes on code or insert some explanation about the code. We call these explanation comment. comments do not have any effect on application run time.

We can also specify comments after end of the statement like the second example

Multiline Comments

Sometimes single line comments are not enough. We can specify multi line comments with /* and */ like below.

LEARN MORE  What Is MySQL Database and Product?

Embed Into Html

Php code can be embedded into Html code easily. In the server side first the php code is executed and the result is put into related position. Below a code is embedded into html.

Case Sensitivity

Php is case sensitive programming language. Case sensitive simply means the same word with uppercase and lowercase are interpreted as different. For example cat is not the same as CAT or Cat . All of them are different.

[rps-include post=6522]

2 Responses

  1. marcel says:

    Amazing job, I’m a beginner that tips are very useful to me!

    Thank you so much!

  1. 30/07/2017

    […] PHP Syntax […]

Leave a Reply

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