learn

what kind of programming language is php

category: Ask
Created by: Dr.Ferrous

what kind of programming language is php

category: Ask
Created by: Dr.Ferrous
twitter google+ facebook pinned 

Question

 i dont know what the abbreviation php stands for but after a quick browse through the application it looked somewhat like a progamming language and i have a keen interest in writing code though i havent the slightest clue how to go about it,what kind of programming language is php

by kaizer

Answer

Thank you for your question, I am glad that you have a keen interest in coding.

PHP is not a programming langauge, it's a scripting language.

Programming language means that when you write a code, you need to go through the compilation process to run it, while scripting language doesn't need to be compiled, the script will be interpreted at runtime, for example:

If you are using Windows, open notepad and type this:

msgBox "Hello World"

Then save it with name "hello.vbs", make sure that the extension is "vbs" not "txt".

("save as type" should be "All Files" as in the image below).

 

Double-click on the file and see what happens:

 

VBS(Visual Basic Script) is a scripting language that comes with Windows, it doesn't need to be compiled, it runs right after you double click on it.

But who is reading the script and doing what it's saying such as showing the message in "hello.vbs"?

There's a program file called Wscript (Windows Script Host) in windows and it's responsible for that.

Wscript reads the script line-by-line and simply interprets it, "msgBox" means showing a message and the text following it means it's the text that will be inside that message.

 

PHP is the same, but with the following differences:

- Extension is "php" (e.g "hello.php") and a program called PHP.exe interprets the files.
- It's a back-end language, vbs is not.
- It's extremely fast with hundreds of features and commands.
- The developers (who created PHP) made it compatible with Windows, Mac, Linux, IOS... (vbs works only in Windows)

 

Back-end language means that it works inside the computer that is holding your website (the server).

Take the search for example in phpwin.org, here's what happens when you click on search button:

1- The browser sends the search word to the server.
2- The server runs PHP.exe to interpret the php file that is responsible for the search process.
3- A file such as "search.php" does the search process and gives the results.
4- The server sends the results to your browser for you to see them.


The search process is done inside the server of phpwin.org using PHP, that's why it's called "Back-end language", you don't see anything except the results.


I think this explanation is enough, now you can go straight to lessons and start from the introduction.