What is PHP?
PHP is a server side programming language mainly used to build dynamic website and mobile apps. PHP is freely available ( open source ) language.
To use php you have to install a package on your computer and using a text editor you can write php code. You can run php code on a web browser using a web server that has php language enabled.
How does php work internally?
A computer does not understand a human language. All it knows is a binary language 1 or 0. A human can write code in php language because php language is human friendly.
Your computer converts human language ( i.e. php ) to binary language so that computer knows what to do with instructions. Using php you can write set of instruction which is known as a code.
Internally compiler converts this code into machine language i.e. binary so that computer knows what to do with given instructions. You have to learn basic syntax for php language in order to write a code.
What are the advantages of using PHP?
Followings are some of the advantages of using php language:
- php is written on top of c language
- php can be run on major operating systems
- php7 offers great performance over other languages
- using php you can build dynamic website easily
- it is a loosly typed language
- It is freely available and have a large community to support
- You can use php to interact with major databases
How can I write php code?
In order to write php code you should have basic knowledge of following things:
- You need to know how you can run php code on your computer ( Intallation Process )
- You need to learn client side languages like html and css
- You need a text editor to write php code
- You need a server that knows about parsing a php response
- You need to know to have basic debugging skills
Dont worry about above things we will learn them slowly one by one. Let's just get some basic knowlege about php for now and move on to advance level of php programming slowly.
What is the difference between php and html?
html is a markup language used on client machine while php is a scripting language used on server side. Using php you can generate html code but not vise versa.
html runs on browser while php runs on a web server like apache or nginx etc..
If you want to buld a dynamic website you need to learn about how a web page is generated on a web browser. Using html you can create a web page.
To make a web page look stylist or to add colors or some other eye caching features you need to learn css. Html and css can not do work alone. Using html and css you can only create a web page and wont be able to perform any tasks.
PHP helps you build dynamic websites you can store your website related data on a database server. PHP helps you fetch such data and can display this data on a web page.
What sites use PHP?
Followings are some of the popular website that you might be browsing and they all use php language:
- Learn2torial of course
How to install PHP on my computer?
Well know you know why php is used and want to learn how you can write a php code. In order to get started with php you need to first install php on your local machine i.e. your computer.
- Install PHP on Linux based computer i.e. Ubuntu
- Install PHP on Windows computer
- Install PHP on Mac computer
Before we jump on to php you need to know about php versions. Since php is developed developers constantly contributing to improve php language.
Each time improvement is made to php a new version of php comes out. Currently, php7 is a current version of php that we will use in order to learn.
Keep in mind with new php versions some of the php functions used in previous version of php might not work because either function is written in better way or scraped entirely.
We will learn all about php7 in upcoming tutorials.