PHP Introduction

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

PHP Introduction :-

Earlier PHP comes out to be a small open source project. More and more people found it useful. The first version of PHP was unleashed in 1994 by Rasmuslerdorf. PHP in itself is recursive acronym for “PHP: hypertext preprocessor”. PHP is a server side scripting language that is embedded in HTML. It manages databases, dynamic contents and session tracking. It can even built  entire e-commerce site.PHP is integrated with a number of popular databases as MYSQL , postgreSQL, Oracle , Sybase, Informix, and Microsoft SQL Server. PHP in its execution is pleasingly zippy , especially when compiled as an Apache module on Unix side.

PHP supports a large number of major protocols such as POP3, IMAP, and LDAP. Well there’s a lot to talk about PHP. Let’s make our PHP description more brief and understandable under following categories:

WHAT IS PHP?

  • This is hypertext preprocessor.
  • It is a server scripting language.
  • PHP is free to use.
  • Dynamic Websites can be developed using PHP.
  • On Windows, PHP package can be installed using WAMP or XAMPP.
  • While on Linux, you can install LAMP to install PHP.
  • PHP is a server scripting language while JavaScript is a client scripting language.

WHERE PHP CAN BE USED?

  • For developing dynamic websites.
  • PHP can be used with HTML, CSS and JavaScript.
  • Being a server side scripting, this can also be connected with database.
  • So PHP can move data from forms to database tables.

DIFFERENCE BETWEEN CLIENT-SIDE AND SERVER-SIDE SCRIPTING

Client side scripting always runs on client side browser while the server side scripting runs on the server end not the client end.

Before going into discussion about differences between client side and server side, firstly understand what client side and server side exactly are.

CLIENT SIDE ENVIRONMENT:

The client side environment is used to run scripts that is usually browser. Here the processing takes place at the end users side. The source code runs directly on the browser after transferring from the web server to the users computer over the internet. The scripting language is enabled on the client computer. For the purpose of security risks sometimes users, switch off the scripting facility. In this case a message usually pops up to alert the user when script is attempting to run.

SERVER SIDE ENVIRONMENT:

In server side environment scripting language that runs is a web server. Here script runs directly on the web server to generate dynamic HTML pages to fulfil the user request. These HTML pages are then send to client browser. This provides interactive web sites that interface to database or other data stores on the server. On the other hand in client side scripting scripts are run by viewing web browser, usually in Java script.The main advantage of server side scripting is that it has ability to highly customize the response based on the users requirements, access rights,or queries into data stores.

GRAPHICAL REPRESENTATION:

Below is the graphical representation of client side and server side scripting:

 

intro

Here your code is split into two parts client side and server side.The two sides uses HTTP request to communicate. PHP is execute on the server and output some HTML /JavaScript code. This code is send as response to the client. On the client side HTML is interpreted and JavaScript is executed. Once Php has delivered all the responses the script ends .Now nothing will happen on the server side until ta new HTTP request arrives.

 conversation

So if we need to call PHP then we have two options to choose from:

  1. Reloading page and send HTTP request.
  2. Without reloading .Here you can make Ajax call with Javascript.

DIFFERENCE:

Let’s differentiate both more briefly in a systematic way as below:

BASES CLIENT SERVER SIDE
DEFINITION Client side scripting is when all the code is previously on the browser & the page alerts stand on the user input. Server side is when users browser creates a back request to the server and the script makes the dynamic page based a Figure of situation.
ACTION It takes action on user’s computer. It takes action on web server.
ACTION Here action takes users computer. Here action takes place on a web server.
ACCESS It provides functionality without needing access to a web server. It requires server sides script when it has to get data from Database and use in show information.
CONTROLS Controls are only JavaScript and JQuery. It does not go code behind control state, view state, and hidden fields. Here controls are application and session.
LOADING Client side does not code behind so it’s loading is fast. Its loading is comparatively low to the client side scripting.
EXECUTION Client side script are downloaded, inter preted and executed by the browser depending upon the cpu, memory and speed. It runs on the srever depending on the memory, and CPU speed.
EXAMPLE The dropdown menu of JavaScript. Here Javascript alert show the menu is displayed. Every code is running locally. On a website the user clicks on the links of products. Then the server runs PHP code to generate a page by locating each and every product in the database. The page is send back to the user browser for presenting.

PHP TAGS

To start coding in PHP, you should know about php tags.
Php code starts with <?php and ends with ?>

There are other ways too by which php code can be started.
It starts with <? And ends with ?>

This is called Short Open Tags

But to use this, you need to enable the option of “short_open_tag” in php.ini file.