About PHP, syntax, comments and code

5/5 - (1 vote)

What is PHP?

  • PHP (acronym for Hypertext Preprocessor) is the most popular server-side, open source scripting language, used to build dynamic website.
  • PHP scripts are executed on the server.
  • PHP runs on various platforms (Windows, Linux, Unix, Mac) and is compatible with almost all servers available today (Apache, IIS, …)


What is a PHP File?

  • PHP files have the extension “.php”.
  • PHP files are executed on the server and the result is returned to the browser as simple HTML.
  • PHP files may contain besides PHP code, also HTML, CSS or JavaScript.


About PHP syntax

The PHP script can be placed anywhere in the document and must begin with <?php and ends with ?>, as follows:

// PHP code goes here

Remember: all PHP statements must end with a semicolon (;).


About PHP comments

Unlike Html comments, PHP comments will not be displayed to your visitors, who may view your website’s source code.

PHP comments serve as explanatory notes and are only useful for PHP programmers, because the only way to view them is by opening the PHP file for editing.

PHP comments are lines that are not read/executed as part of the program.

PHP supports two types of comments:

  • single-line comment;
  • multiple-lines comment block;
// This is a single-line comment

# This is also a single-line comment

This is a multiple-lines comment block
that spans over multiple lines


PHP Case Sensitivity

In PHP, all keywords (if, else, while, switch, echo, …), classes and functions are NOT case-sensitive, while all variable names are case-sensitive.

Hello there!

I hope you find this post useful!

I'm Mihai, a programmer and online marketing specialist, very passionate about everything that means online marketing, focused on eCommerce.

If you have a collaboration proposal or need helps with your projects feel free to contact me. I will always be glad to help you!

subscribe youtube

Leave a Comment