Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
PHP examples - source code and try it out too

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
Try it!

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 articles
H050 - PHP - General
  [116] The next generation of programmer - (2004-11-13)
  [235] Preparation for a day's work - (2005-03-04)
  [2097] PHP Course - for hobby / club / charity users. - (2009-03-22)
  [2222] A (biased?) comparison of PHP courses in the UK - (2009-06-07)
  [2227] Learning PHP, Ruby, Lua and Python - upcoming courses - (2009-06-11)
  [2400] Are you wanting to learn PHP? - (2009-09-08)
  [2430] Not just a PHP program - a good web application - (2009-09-29)
  [2504] Learning to program in ... - (2009-11-15)
  [2559] Moving the product forward - ours, and MySQL, Perl, PHP and Python too - (2010-01-01)
  [2589] Your PHP code does not work? Here is where to start looking. - (2010-01-18)
  [2663] Improve your PHP on a weekend away - (2010-03-05)
  [3025] Learning to Program ... in PHP. Course examples. - (2010-11-01)
  [3530] A typical weekend?? - (2011-11-28)
  [3952] PHP revision ... by example. - (2012-12-15)
  [3966] Our examples work with any recent version of PHP - (2013-01-01)
  [4314] PHP training - refreshed modern course, backed up by years of practical experience - (2014-11-16)

Back to
Perl 6 - When will we have a production release?
Previous and next
Horse's mouth home
Forward to
Bath - Melksham - Devizes. Bus route changes, new timetable
Some other Articles
Hot Courses - Perl
A future vision for Melksham
addslashes v mysql_real_escape_string in PHP
Bath - Melksham - Devizes. Bus route changes, new timetable
PHP examples - source code and try it out too
Perl 6 - When will we have a production release?
Some Ruby lesser used functions
A special day - last Friday in July
Increasing Java Virtual Machine memory for Tomcat
Q - Should I use Perl or Python?
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page

This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

1 unpublished comment pending on this page

edit your own (not yet published) comments

© WELL HOUSE CONSULTANTS LTD., 2023: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/1722_PHP ... t-too.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb