2

I was reading about the difference between scripting language and programming language and there was a point that scripting languages run on the client machine while programming languages like c#, vb, java and also php run on server machine. But php is said to be a scripting language. Now this is confusing! We mostly use php to write a code which runs on server, so how come php be a scripting language?

Amit Kaushal
  • 429
  • 1
  • 9
  • 25
  • Lots of duplicates. http://stackoverflow.com/q/12848882/4260462 , http://stackoverflow.com/q/101055/4260462 , http://stackoverflow.com/q/1514206/4260462 , http://stackoverflow.com/q/101055/4260462 – Geo Tom Jul 06 '15 at 05:07
  • Possible duplicate of [PHP script language or programming language?](https://stackoverflow.com/questions/12848882/php-script-language-or-programming-language) – Tim Abell Sep 18 '19 at 21:27

3 Answers3

8

PHP is a scripting language (it uses an interpreter) which is mostly run on a server. Javascript is also a scripting language, but it's mostly run on a client.

Similarly, c and c++ are compiled languages (the final programs do not need an interpreter)and can run on client or server hardware.

All four are programming languages.

The distinction between scripting languages and compiled languages resides in the methods used to run them, not the hardware on which they are run.

3

PHP runs server side. Server side is just that, it runs through the server and then gets outputted to the client. Client side code like JavaScript for an example, runs client side in the browser, and not through the server.

A scripting language is a very broad term for a programming language. Here is an excerpt from Wikipedia on scripting language.

A scripting language or script language is a programming language that supports scripts, programs written for a special run-time environment that can interpret (rather than compile) and automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), and embedded systems. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language. Scripting languages are also sometimes referred to as very high-level programming languages, as they operate at a high level of abstraction, or as control languages, particularly for job control languages on mainframes.

Sam B.
  • 283
  • 4
  • 17
2

A scripting language or script language is a programming language that supports scripts. PHP is Scripting language because we can embed php code into HTML. If code of programming language can emmbed with other language or integrate with other language or script called scipting language. PHP is server side language because php requires server to run a code.Code of php get executed on server and result of execution is return to the browser.thats why php is called script language and server side language.