Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - 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))

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
PHP module H999
Additional PHP Material
Exercises, examples and other material relating to training module H999. This topic is presented on public courses Learning to program in PHP, PHP Programming, PHP Programming, Learning to program in PHP

PHP is a powerful language with many exciting capabilities, several of which are supported through function libraries. This module covers some of the more popular additions such as sorting, graphics, XML handling, and using PHP in stand-alone programs. It also covers more advanced language features such as variable typing and multidimensional arrays.

Related technical and longer articles
Example - PHP form, Image upload. Store in MySQL database. Retrieve.
Graphic User Interfaces (GUIs)

Articles and tips on this subjectupdated
4655Image indexer / thumbnail display scripts in PHP
I often say that example programs provided to show "how to" become too complex too quickly - going straight from the simplest of programs (a.k.a. a "hello world") though to something much more complex in a single leap. I take multiple steps as I proceed on our courses, and I try to make sure that I ...
2016-02-25
 
1451More PHP sample and demonstration programs
It's amazing how many little (and not so little) new programs and demonstrations I write - here are some from the last couple of days: • The Melksham / Bowerhill Christmas Quiz, 2007. Ten questions, work out the answers, click on a link at the bottom the page and it will be refreshed to tell you ...
2013-01-02
 
789Hot answers in PHP
We've got a lot - a LOT of demonstrations and source code on our site. Here are a few of the most popular ones all brought together in a single listing. Enjoy ... Searching - how similar are two words? - try about source Does a particular URL exist? - try source Uploading an image to a database ...
2013-01-02
 
3210Catchable fatal error in PHP ... How to catch, and alternative solutions such as JSON
When you ask your program to "print out an object", you're really looking to convert a data structure into a stream of characters, and it's not really obvious what you're looking to do. If you try to print out an object in PHP:   print ($result . "\n"); where the $result variable contains ...
2011-03-22
 
1390Converting from postal address to latitude / longitude
Do you sometimes find odd gaps in new procedures you follow - "I can see everything I need to do to make X happen, except" ? I hit one of those yesterday. When learning how to interface to Google maps ... all the information was there, except there was no way that I could spot to click on a map and ...
2011-01-25
 
3118Arrays of arrays - or 2D arrays. How to program tables.
It's shorthand when you're learning a new programming language to ask "how does it handle multiple dimension arrays" ... but in practise very few languages actually support true multidimensional arrays these days, and in those which do you might be well advised to use an alternative that's more flexible. What ...
2011-01-03
 
2684Exception handling in PHP
PHP has exception handling - where you can try a block of code; it it completes, that's good and normal, but if something doesn't work in the normal manner an exception is thrown, and a piece of code to mop up the problem is run, in a catch block. I've written an example to show this ... I have a function ...
2010-03-25
 
2215If nothing, make it nothing.
Here's a peculiar PHP statement I wrote this morning:   if ($aindex[$chk] == "") $aindex[$chk] = ""; What was I doing? I am actually checking to see whether there's anything in an array element and if there isn't (which could be because it's empty or because it doesn't yet exist), then it ...
2009-06-03
 
2073Extra PHP Examples
Yesterday evening and this morning, I was helping with some specific PHP questions ... resulting in some new examples that I've put on the web site. • A program which can be used / allows logins only between 3pm and 5pm on a Wednesday afternoon (and could easily be adapted to let people in at breakfast ...
2009-03-10
 
806Check your user is human. Have him retype a word in a graphic
Do you have trouble with automated programs completing forms on your websites and making cart loads of submissions? Or even just a few spammers submitting their betting ads, performance enhancing pill sites, and share purchase suggestions? And yet you don't want to have to have anyone who wants to ...
2009-01-14
 
1104Drawing dynamic graphs in PHP
The web is all about presenting data, and a picture paints a thousand words - so what's better than a graph to quickly and easily present figures and trend to yor web site visitor? There's a great deal of software available to produce static diagrams and graphs as image files - .gif or .jpg are the ...
2008-12-26
 
1010Dates, times, clickable diarys in PHP
It's that quiet week between Christmas and the New Year that's an excellent chance to catch up - a little - on some of the things that are important but have been abandoned in the mad rush of urgent things these last 9 months. Like writing a booking system and like - I hope - spending long overdue ...
2008-12-21
 
1389Controlling and labelling Google maps via PHP
"Can you use PHP to control what you show on a Google Map?" An innocent question that lead me off on an interesting exploration when I should (!) have been doing other things - but a very worthwhile couple of hours, and great fun! How do you do it? 1. Apply for your Google Maps key (you'll need to ...
2008-09-29
 
1391Ordnance Survey Grid Reference to Latitude / Longitude
I've already written about conversion of postal addresses to latitude and longitude using Google's interface - but what is I want to convert the Ordinance Survey's grid references into latitude and longitude? Google's interface doesn't support the OS units - and in any case it's "just" a a calculation. ...
2008-08-30
 
239What and why for the epoch
The Epoch occurred on 1st January 1970 ... at midnight, at the start of the day, GMT. It's an important concept in many programming languages, which work with times and dates before and after the epoch - it means that you can compare dates and times easily, even where month ends and different timezones ...
2008-05-16
 
687Presentation, Business and Persistence layers in Perl and PHP
I've been writing about the Presentation, Business and Persistence tiers (and within each of them the MVC or Model, View, Controller or MVC structure) for a JBoss presentation I'm doing this week - but I scarcely expected to find myself putting them to good if unusual use this evening when sorting out ...
2008-05-10
 
320Ordnance Survey - using a 'Get a map'
Sunday, and a chance to play. I've been interested in the possibilities offered by Ordnance Survey's "Get a map" service - which allows (with limitations described on their site) their mapping to be captured and used on web sites in a not-for-profit way. I've started to put up a whole load of pictures ...
2008-05-10
 
1485Copyright and theft of images, bandwidth and members.
Some poor home school kid in the USA just got the sharp end of my tongue .. I had just signed up to a political forum and so had he (he said) and he wrote: Also I was wondering if you would join my political forum at http://www.xxx.org .(I know this is an advert but it's really hard to get a new board ...
2008-05-10
 
1519Flipping images on your web page
Are you seeing this picture the right way up, or upside down? If you're seeing it the right way up, you're using Mozilla, Firefox, Safari, Netscape or almost any other browser ... except Internet Explorer. With Internet Explorer, it might be up side down! This is no "failure" on the part of some ...
2008-05-10
 
937Display an image from a MySQL database in a web page via PHP
There's lots of clever scripts around to tell you how to get images in and out of databases, but nothing simple to show you the principles of including such an image via (say) PHP in a web page. So here goes. you need TWO URLs - you need the HTML page that's going to contain the image, AND you need ...
2008-05-04
 
1623PHP Techniques - a workshop
So many people know the basis of PHP - the language constructs themselves and how they work individually - but could really benefit from learning how to make the best of those elements. And these techniques for putting the elements together are so important that they should not be crammed onto the end ...
2008-04-27
 
1505Script to present commonly used images - PHP
"What are the most popular pages in your picture library, and where are they used from?" An interesting question and I could analyze raw web logs to find out the answers. However, most of our images are managed by a script that retains extra information such as an image title, and uses are logged ... ...
2008-01-14
 
1270PHP Standalone - keyboard to screen
PHP is a web language. Yes. And No. You can use it "standalone" too, and we often do so; to develop a whole lot of functions for web use in PHP, then duplicates in some other language, would be frankly silly after all. And so it is that during the current course, I've been running rather more demos ...
2007-07-19
 
1194Drawing hands on a clock face - PHP
Would you like to draw clock face hands on to an image (such as the one shown here, with the time in UK when you called the page up!)? It's easier than you think using PHP's GD module. Instead of supplying a fixed image in your <img> tag, provide the URL of a PHP script that reads an image and ...
2007-05-19
 
1053Sorting people by name in PHP
Our petition for a reasonable train service is going great guns - over 1000 signed up in just over a week, amongst them significant players such as MPs, MEPs .... but, my goodness, the list as presented by the web site is hard to look through. So I've grabbed a copy of the list and sorted it - see here. Sorting ...
2007-01-26
 
1020Parallel processing in PHP
PHP is designed - where necessary to the exclusion of other uses - as a web page tool. In other words, where a language design decision needs to made between something that is good for the web use, but bad for more general use, the decision will always be in favour of the web. "I don't care how it effects ...
2007-01-03
 
917Syntax checking in PHP
If you want to check the syntax of your PHP page without actually running it, the -l option (that's lower case letter L) to PHP at the command line will do that for you: wellho@lightning:~/public_html$ php -l index.php No syntax errors detected in index.html wellho@lightning:~/public_html$ Remember ...
2006-11-07
(short)
839Reporting on the 10 largest files or 10 top scores
What are the biggest 10 files in or below this directory? What are the 20 'worst' spams I have received in the last month? What are the five top scores recorded for a popular game on my web site? It's a very common requirement indeed to provide a program to answer questions like these, and if you've ...
2006-08-19
 
822PHP - a team member leaves
I read that Jani Taskinen, one of (quite a number) of lead developers on the PHP project, has quit after six years. Much PHP development takes place in Israel, and Jani - who has been a UN peacekeeper and who has friends in the Middle East conflicts, concluded that he could not continue to work with ...
2006-08-04
 
563Merging pictures using PHP and GD
I wanted, regrettably, to fade (tear) one picture into another - a train at Melksham into a picture of a disused railway trackbed. We have one of those nearby at Seend, where the Trowbridge - Devizes - Reading - London train service used to run. Here's another 2 options I looked at: and The ...
2006-06-09
 
54PHP and natural sorting
If you sort (8, 9, 10, 11, 12), how do you want them to be output? "In the order you've just listed, Graham", you'll probably say. But if they're strings and you sort them, then you'll get the order 10, 11, 12, 8, 9 output if you just use a default sort, because the character "1" comes before the character ...
2006-06-05
 
Examples from our training material
2dar.php   2 dimensional array in PHP
ac_check.php   Sorting an associative array
aso.php   First sorting example
dademo.php   Date and Time and sorting em in PHP
exc.php   An exercise in sorting
exp.php   Exceptions in PHP
fader.php   Fade from one image to another
feeder.php   Script to handle image library in MySQL database as if it was a directory of images
gmap.php   Google Maps / PHP - show your office
gobbler   Forking in PHP - parallel processing
grids.php   Shows you where a place is on an Ordnance Survey Map
hands.php   Draw hands on a clock
hml.inc   Horses Mouth - latest topic feed
image1.php   Generating a graphic in PHP
image2.php   Generating a button with variable graphics and text in PHP
images.xml   Sample XML file as used in xslt.php4 example and others
imgdump.php   Generate the html to call up 10 images from a database
imgfeed.php   Show an image held in a MySQL database
imgflip.php   Flipping an image in PHP
imglist.xsl   Sample XSLT template as used in xslt.php4 example and others
loclook.php   Google Maps / Geocoding demo
lottery.php   Array manipulation functions range, shuffle etc
mergeover.php   Stippleover from one image to another
mkgraphic.php   Stand along programming in PHP / also graphics example
ml1.php   Simple Author extraction from Medline
mustcount.php   Script to accompany access counter discussion
nats.php   Natural Sort Order demo
os2latlong.php   Convert Ordnance survey grid positions to latitude / longitude
oursites.php   Parallel processes in PHP
php_parallel   Parallel processing example in PHP
picclim.php   Search a database of images
rome.php   Random image for use in a web page
showcount.php   Show counter record file
site_title   Stand alone script - grab title of remote web page
tear.php   Tear from one image to another
th.php   dynamic thumbnail generator
thumb.php   thumbnailing an image in one file and saving in another
thumbview.php   Thumbnail index and image view application
tinso.php   Sorting an associative array
uso.php   User defined sorting
uso2.php   More complex user defined sort
vars.php   Variable types in PHP
whowentwhere.php   Practical example of 2 dimensional array in use
xdo.php   Reading an RSS feed in your PHP page
xml1.php   Xml handling in PHP
xml2.php   Second example - using PHP to handle XML
xml3.php   Using PHP to handle XML, stand alone!
xslt.php   Process an XML file through an XSLT template and insert result in a PHP page
Pictures
Regular Expressions in PHP
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from [here].
Topics covered in this module
Variable declaration and typing.
Explicit convertors.
Sorting.
User-defined sorting.
Sorting an associative array.
Other array re-ordering functions.
Multidimensional arrays.
Flexibility with multi-dimensional arrays.
Graphics.
Using PHP to add a counter to an HTML page.
A graphic example.
Using PHP away from the Web Server.
How to use PHP away from the Web Server.
Example of PHP running from keyboard to screen.
What is XML?.
XML handling in PHP.
A Simple Parser.
Extending the example.
Analysing XML as a stand-alone program.
Other XML Subjects.
What is XSLT?.
Handling XSLT in PHP.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Ruby, Lua, Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre.


You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 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/resources/H999.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb