The move to our new server has given me the impetus to look at some of the online examples we have on our server - code you can try out, then see how it works - and I've started with some of the PHP ones ...
A sample application shell using the "4 layer model" which keeps the business logic, the web helpers and the look and feel each in a separate file (or set of files) so that each can be independently maintained. Try it!
Instead of displaying in your data in a single column, why not show multiple values per line? That's what this demonstration shows! Try it!
Five short demonstrations in PHP - showing the current date and time, including an image that changes every hour, including a message of the day, having a page that automatically echos its own URL, and a page that displays its own source code. Try it!
A simple MySQL database query - with a form to allow you to tailor it further if you wish. Try it!
It's possible for your web site to recognise the preferred language of your visitor - this demonstration in PHP shows you the bare bones of how to do it! Try it!
If you want your web site to save a file on your visitor's disc, you'll have some security issues to content with. After all, users really do NOT want to visit your page and have you potentially hide things on their system. By setting the MIME type, however, you can trigger their browser's mechanism to handle the data in a way such as offering them a "save to file". This example shows you how to save a .csv (comma separated variable) file to your user's disk - with his permission Try it!
How to create and use a multidimensional array (array of arrays) in PHP. Simple example. Try it!
and a further example of array handling in PHP Try it!
Laying out tabular data from PHP - bus times around the Melksham area. But please bear in mind that bus routes can change qith as little as 6 weeks notice and you'll find these are already out of date - but the code is good! Try it!
A demonstration of how you can use PHP to "cloak" one web site behind another; in this training example we have not rewritten style sheet and images URLs so that it gives you an inside view as to how this can be done - and alerts you to the security dangers too (we'll go through those on our PHP techniques workshop
. Try it!
Pages that automatically refresh every 20 seconds or every minute are often produced using a <meta tag. This example shows you how we produce a page that updates every minute. Try it!
We also have an enhanced version in operation (if you want to sit there and watch a series of pictures while time ticks by ;-) .. http://www.wellho.net/clock/
The ASCII character set - every code in HTML from ADE-32 to ADE-255. The page shows you the codes, the course shows you how we do it! Try it!
A demonstration of PHP's switch
statement - tossing a coin to give you heads or tails, and a default that handles other conditions
Another small demonstration in PHP - entering a temperature in degrees Celsius and converting it to Fahrenheit and Kelvin. The demonstration really shows conditional statements in PHP, telling you whether water is solid, liquid or gas at the temperature that you enter. Try it!
Cookies are sent to your browser by many web based applications ... and a copy is then returned by your browser each time you visit a page on the site. This is how web based applications usually keep track of who is who in a potentially very busy environment - a critical element of web applications which we introduce on our PHP Programming course
and cover in more detail on our PHP techniques workshop
. This demonstration shows how cookies are set, reported back, and deleted. Try it!
PHP's Object Oriented model is now excellent - and it's the way you should
code if you're writing a larger application, especially one that deals with a whole series of different types of information which are similar to each other but not the same. Instead of writing separate code for each type of thing (I am trying to avoid using the word "object"), you write a single piece of code and then a series of extras that just define the changes (I am trying to avoid using words like "extend class" in that description). An array of things ("objects, remember) can will then be handled by the appropriate piece of code when you run a function ("method") on them ... that's known as "polymorphism". We run a course on Object Oriented PHP
which covers both the principles involved and their application. Of course, all the clever stuff is hidden in the code - but you can see how simple the outputs can be and link to the code from this demonstration: Try it!
There are many more samples to follow ... I had better make this just the fist page in an occasional series and come back with some more later! (written 2008-07-26, updated 2013-01-02)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesH050 - PHP - General 
PHP training - refreshed modern course, backed up by years of practical experience - (2014-11-16) 
Our examples work with any recent version of PHP - (2013-01-01) 
PHP revision ... by example. - (2012-12-15) 
A typical weekend?? - (2011-11-28) 
Learning to Program ... in PHP. Course examples. - (2010-11-01) 
Improve your PHP on a weekend away - (2010-03-05) 
Your PHP code does not work? Here is where to start looking. - (2010-01-18) 
Moving the product forward - ours, and MySQL, Perl, PHP and Python too - (2010-01-01) 
Learning to program in ... - (2009-11-15) 
Not just a PHP program - a good web application - (2009-09-29) 
Are you wanting to learn PHP? - (2009-09-08) 
Learning PHP, Ruby, Lua and Python - upcoming courses - (2009-06-11) 
A (biased?) comparison of PHP courses in the UK - (2009-06-07) 
PHP Course - for hobby / club / charity users. - (2009-03-22) 
Preparation for a day's work - (2005-03-04) 
The next generation of programmer - (2004-11-13)
Some other Articles
Hot Courses - PerlA future vision for Melkshamaddslashes v mysql_real_escape_string in PHPBath - Melksham - Devizes. Bus route changes, new timetablePHP examples - source code and try it out tooPerl 6 - When will we have a production release?Some Ruby lesser used functionsA special day - last Friday in JulyIncreasing Java Virtual Machine memory for TomcatQ - Should I use Perl or Python?