From Learning to Program in PHP and PHP Programming - presented this week, and repeating at regular intervals - see schedule
Let's say that I want a web page - with a single URL (Uniform Resource Locator / name) - to show up differently in my browser depending on how I run it ...
• I write the text that's to appear on the page into a text file
• I add HTML (Hypertext Markup Language) tags - extra bits of information enclosed in < through to > characters - which indicate what's to be headlines, what's to be italics, etc.
• I add further tags which include program elements that are to run before the data is displayed, enclosed in <?php through to ?> character sets and within those tags I write in the PHP programming language.
• I store the text file on my web server computer, in an appropriate place for the web server software (most commonly the Apache httpd server) to locate it when the appopriate URL is used by a client (that's your browser, or an automated program such as the Google indexing robot) to find it.
• I configure my server to run the program elements enclosed in the <?php through to ?> character sets (this is often a once-only job telling the server that anything ending in .php is to be handled that way.
Then when someone calls up my file via its URL ...
• The SERVER relpaces the <?php through to ?> sets with the result of running that code
and passes it on (across the internet) to
• the CLIENT which follows the instructions in the remaining < through to > character blocks as regards formatting and
• displays the untagged (unblocked) text.
Each of these stages can be seen / viewed if you wish to do so. In this screen capture, the original file as stored
on the web server is seen at the bottom of the diagram. Above it (and to the right) is the text stream that's outputbythe web server and passed to the browser - we can see this by using the "view source" button on our browser (most browsers and do this). And in the top left of the screen capture is what the user sees through his / her browser.
That's a straightforeard example of the mechanism of PHP ... all I've done is to insert the day of the week into this particular page. But just think how much more I can do as I read forms from the user to control what gets sent out, access databases on the server, and even call up other web sites from within my PHP ... (written 2012-11-07, updated 2012-11-10)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesH102 - A First PHP Web Page 
A comment on comments in PHP - (2013-04-28) 
Using print_r in PHP to explore mysql database requests - (2009-10-01) 
Question on division (Java) - Also Perl, PHP, Python ... - (2007-11-28) 
It's REALLY easy to add a little PHP - (2006-02-26)W603 - Web and Intranet - Server Side Technologies 
Sending a message to the server and changing text on a page when a button is pressed - (2014-05-23) 
Django Training Courses - UK - (2012-04-23) 
Checking robots.txt from Python - (2009-07-12) 
Effect on server when memory runs out and swapping starts - (2009-02-26) 
Using server side and client side programming together - (2008-08-11) 
PHP training courses every month - (2008-04-18) 
Online hotel reservations - Melksham, Wiltshire (near Bath) - (2008-02-24) 
Korn Shell scripts on the web - (2007-09-25) 
.php or .html extension? Morally Static Pages - (2007-09-17) 
robots.txt - a clue to hidden pages? - (2007-01-13) 
Parallel processing in PHP - (2007-01-03) 
Where is a web site visitor browsing from - (2006-05-24) 
Easy feed! - (2006-03-21) 
How similar are two words - (2006-03-11)
Some other Articles
What is a web framework?Multiple page web applications - maintaining state - PHPBODMAS - the order a computer evaluates arithmetic expressionsPHP variables - dynamically typed. What does that mean?How does PHP work? While, for, foreach or something else to loop.How many times ... has this loco headed west through Tenby? - Python exceptionsSand to Arabia, Coals to Newcastle or Woodburners to RussiaHow well do you know Perl and / or Python?Identifying your real customers and keeping them well informed fast