PHP is the most common server-side scripting language used in web development. So what is PHP?
PHP is a powerful and robust tool which allows you to manipulate data to your current needs and thereby produce dynamic web pages. A dynamic web page is one where the content is not fixed (as it is in HTML). The page's content is retrieved from a database upon the web user's request to view the page (by clicking on a link or typing in the page URL).
PHP is referred to as a server-side scripting language because the code is executed by software on the website's server. When the request for a page is made, the PHP script is run and it then outputs the information generated to the web page. The information will not change once the page has been loaded.
PHP is most widely used in web applications, but can also be used for software development. It makes use of object-oriented programming (OOP) which allows you to group functions and thereby not have to duplicate processes performed. This reduces the time taken for a page to load.
PHP is often used in conjunction with a database such as MySQL which stores the required information, but it has many other functions. PHP can be used to work with and manipulate data in .CSV or .txt files. It can even be used to edit images.
Putting it all together in a website:
PHP scripts are used to control access to your website's admin area by checking if the user is logged in or not.
When you select a page to edit a PHP script is used to retrieve that page's information from the database and populates the fields accordingly.
When you edit the content and click 'save' or 'update', a PHP script is triggered which will update the information stored in the database.
When a visitor clicks on the link to that page, a PHP script runs which retrieves the current information from the database.
Similarly PHP scripts can be run to edit images when they are uploaded or retrieved.
PHP is open-source language which means that no licensing is required to use it. MySQL database software is also open-source. Because of this, the hosting costs for PHP websites are generally lower than those for Microsoft-based programes like ASP.net and MSsql.