Introduction to PHP

Introduction

Today we will only give just a basic intoduction about PHP. As we will move further we will dive deep to enhance your skills:

PHP is an easy to learn the language. I personally recommend learning PHP immediately after you have gone through C/C++, instead of learning any other high level language Java or .Net. But before that, you must also have a working knowledge of basic HTML tags and writing a CSS file. PHP is very interesting and I assure you that after learning it, you won’t ever want to switch to any other programming language unless you deliberately want to.

When you hear the word PHP,  what’s the first question that tickles your mind?

Surely, What is PHP?

 PHP stands for Hypertext Preprocessor but earlier it was known as Personal HomepagePHP is a server-side scripting language designed for web development, but also can be used as a general-purpose programming language. Originally created by Rasmus Lerdorf in 1994.

  • PHP is an open source, interpreted and object-oriented Server-Side scripting language i.e. executed at server end. It is used to develop web applications (To understand what’s the difference between web page, websites and web apps watch the video embedded in footer of our page) .It has variables, functions, arrays just like another programming language C, C++, Java, etc.
  • PHP is a scripting language just like Javascript, as it does not involve any separate compilation process. It doesn’t mean that the PHP code doesn’t compile at all. It actually does! Just that everything happens on the fly. Javascript Engine is in the browser, while PHP Engine is on the server.
  • PHP is faster than another server-side scripting language e.g. ASP and JSP.

Note: In this tutorial, you will be provided lots of PHP snippets to understand the topic well. The PHP file must be save with .php extension. Let’s see a simple PHP example.

<?php
echo “This is Tekraze”;
?>

OUTPUT: This is Tekraze

  • PHP code starts with <?php tag. This tells the PHP engine that it is the start of the PHP code.
  • In PHP, comments are written with “/*  */” or “//”.  “/*  */”  is used for multi-line comments, while “ // ”  is used for single line comments.
  • echo statement is used for printing values.