PHP does not execute on 'client-side' (ie: the visitor's browser), but rather relies on the web host (server) to run the commands. The advantage to this is that visitors do not need any special browser and do not need to download anything to use web pages to run PHP scripts. Additionally, the scripts run extremely fast, since they are executed all on the server, with the results being served up to the visitors browser. This prevents a lot of back-and-forth interaction between client and server, making script execution very quick.

PHP also performs 'If' logic, using various variables and testing for certain conditions before deciding which part of the script to execute. For example, in a blog, the script may check to see if the visitor to a post is actually the Admin logged in...if it is, it will display an 'edit' link to allow the Admin to make changes to the post. Non-admin visitors would not see that link.
As languages go, PHP is on the simple side. The syntax is not terribly difficult, and the functions are basic. It is specifically called a 'scripting language', because it cannot run as a stand-alone application, or develop stand-alone applications. It runs 'scripts', within web pages, but it still relies on the web server and the visitor's browser to perform. However, there is enough functionality that clever web developers have been able to make PHP imitate some more robust development languages.
A common example of PHP in use is a blog, specifically a WordPress blog. Most of the pages displayed on a blog are PHP pages, which are essentially HTML pages with a PHP extension (.php instead of .html). The blog uses PHP templates which create all the static portions of the screen, such as background color, layout of the columns, etc. But within the static portions are scripts that do 'dynamic' work, like find the most recent post in the database and put it on the page.
In addition to reading data from a database, PHP can read session variables such as what type of browser the visitor is using, or what dimension their screen is, which allows a website to display pages that are customized for the visitor.

PHP also performs 'If' logic, using various variables and testing for certain conditions before deciding which part of the script to execute. For example, in a blog, the script may check to see if the visitor to a post is actually the Admin logged in...if it is, it will display an 'edit' link to allow the Admin to make changes to the post. Non-admin visitors would not see that link.
As languages go, PHP is on the simple side. The syntax is not terribly difficult, and the functions are basic. It is specifically called a 'scripting language', because it cannot run as a stand-alone application, or develop stand-alone applications. It runs 'scripts', within web pages, but it still relies on the web server and the visitor's browser to perform. However, there is enough functionality that clever web developers have been able to make PHP imitate some more robust development languages.
A common example of PHP in use is a blog, specifically a WordPress blog. Most of the pages displayed on a blog are PHP pages, which are essentially HTML pages with a PHP extension (.php instead of .html). The blog uses PHP templates which create all the static portions of the screen, such as background color, layout of the columns, etc. But within the static portions are scripts that do 'dynamic' work, like find the most recent post in the database and put it on the page.
In addition to reading data from a database, PHP can read session variables such as what type of browser the visitor is using, or what dimension their screen is, which allows a website to display pages that are customized for the visitor.
No comments:
Post a Comment