How to Differentiate between Client-side and Server-side Scripting language
You may have thought that PHP was a programming language. Well technically speaking it’s a server-side scripting language which is different from a programming language on the client’s side. The distinction between them is largely artificial and the lines can get blurry but a general comparison can be done.
Client Side versus Server-Side Scripting
Let us first see the difference between a script and a program
What is a script?
A script only runs in response to an event. It also usually runs a set of instructions by working down the page from the start to the end. It has little or no user interaction after that initial event. So a PHP script does not run until a webpage is requested. Then it launches, follows its instructions from top to bottom and then quits until another action launches the script again.
What is a program?
A program runs even when not responding to events. It continues to run and to wait for interaction whether that interaction comes from a user making choices or from other programs or input. The program also jumps around with instructions a lot that it becomes difficult to identify the clear start and endpoint. It often involves lots of user interaction. Photoshop is a good example, after launching, it keeps running waiting for more interactions for you to tell it to quit. The tasks that it performs are not a linear set of instructions. It jumps around based on the task that you want to do at that particular moment. When scripts get more complex they start resembling programs.
The client-side is the opposite of the server side. So what we’re talking about is where the code does its work. Does the code run on our web server which is server side or on the user’s computer which is client side?
The PHP code is never sent to the user. It runs entirely on the web server and the results of that code are sent to the user’s browser. PHP runs on a web server which means it generally can’t run on its own. We’ll need to have a running web server in order to use PHP. PHP code does not need to be compiled. It’s executed by the web server exactly as it’s written. Other programming languages such as C or Java require the code to be compiled or translated into another form the before it can be used. We’ll be able to just write our PHP and put it where our web server can find it and then we can load up the web page and see the results.
PHP is designed for use with HTML. It can be embedded in our HTML and can be used to generate HTML. In the end, PHP is going to return HTML to the browser. The PHP code is going to be our input and web pages are going to be our output. PHP lets us create dynamic pages. The page content can change based on conditions such as interactions with the user or data stored in the database.
Latest posts by sarah ali (see all)
- Maximum Allowed Google AdSense Ads on your WordPress Blog - January 19, 2018
- How to Get Started with Google AMP in WordPress - January 18, 2018
- 5 Best Backup Plugins for WordPress 2018 - January 14, 2018