PHP – Complete Beginners Tutorial

| Last Updated: | In: PHP Tutorial


PHP stands for Hypertext Preprocessor and is a server-side language. This means that when a visitor opens the page, the server processes the PHP commands and then sends the results to the visitor’s browser, just as with ASP. Typical PHP files will contain commands to be executed on the server in addition to the usual mixture of text and HTML (Hypertext Markup Language) tags. However, PHP is Open Source and cross-platform.

php_architect

PHP runs on Windows NT and many Unix versions, and it can be built as an Apache module and as a binary that can run as a CGI.

Common uses of PHP in web development

1) PHP is the server side scripting language, you can use this for creating a static and dynamic website.
2) You can restrict your visitor to access some private web pages of your website.
3) You can use for encrypting and decrypting data.

Canonical PHP tags and Short-open (SGML-style) tags

If you are ready to start coding in PHP, then you can use the opening and closing tags in two manners. Following are the ways by which you can start and end the PHP tags:

1) < ?php ..... ?> ( PHP tags )
2) < ? .... ?> ( Short-open tags )

PHP Syntax

PHP’s language syntax is similar to C’s and Perl’s. You don’t have to declare variables before you use them.

Running PHP Script from Command Prompt

You can run PHP in two different ways first is using web browsers like google chrome, Firefox, Internet Explorer, Safari, and etc.. and second is using the command line. below are the examples that describe how to run PHP from the command line.

Create a hello.php page and add below code snippets and saved it.

Now run bellow command from command line as follows −

$ php hello.php

You will get the output as :

My first PHP script!

PHP 7.x

PHP7

The PHP development team announces the availability of PHP 7 with improved functions and also they encouraged to developers to test the beta version of PHP with demo application and share the feedback so that PHP team will be fixed that issues.

Below is the list of features which introduced in PHP 7:

What expect from PHP 7

Download the latested version of PHP from its official website. Download PHP


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby.


You may also like:


, , , , , ,