Most people are aware of "programs" that run on computers. Programs are sets of instructions which tell computers what to do.  You have done this by writing PHP and JavaScript.

Low-level and high-level programming languages

You may not be aware that there is a sort of hierarchy of programs and programming languages:

A high-level programming language will probably have been used to create almost any program you can think of including Mozilla Firefox, Microsoft Office or the Linux kernel. Examples include C, C++ and VB.net as well as JavaScript and PHP.

Programming or scripting?

When someone writes a program they:

  1. write the instructions
  2. use software which translates those instructions into an executable file which the computer can run (machine code)
  3. the program is run

When someone writes a script they:

  1. write the instructions
  2. when the script is run the computer translates the code at that time and then executes it

The code you have written in JavaScript and PHP is scripting.

Although programs may be written in a high-level language they go through a conversion which allows them to be used (executed) in a form understood more directly by the processor. This conversion is known as compilation. Before it is compiled a program is made up of text. Afterwards it is made up of the machine code instructions understood by the processor (or at least into code understood by the operating system that runs on the processor).

Scripting languages (such as JavaScript or PHP) are never compiled. They are written the same way but are interpreted when needed not compiled once. For this to work a program must exist which understands the scripting language and can translate it when needed. Every time the script is used (or run) the interpreter will read the text and convert it into instructions for the computer. For example PHP is interpreted by a program on the Web server and Javascript is interpreted by the browser.

The end result may be the same but because scripts are interpreted before running they are generally much slower than programs which are compiled once and are then ready to go without extra interpretation.  Program compilation also tends to be more optimised so that the end result is tweaked better to run on the specific type of computer.