Blog Home | Fife Visits Blog | Fife Rant Blog | Random Computing Stuff Index

Investigating PHP

I am currently working my way through MySQL for Dynamic Websites by Larry Ullman (edition 4).
I currently (as at December 2012) run php 5.3.10-10 and a mysql 5.1.28 database on apache 2.2.22 server on Ubuntu 12.04 in VirtualBox.

Chapter 13: Review and Pursue

Update to chapter 13 calculator.php that works out the total price of widgets including tax: Mar 2013

The php code in the pdf below is an investigation of the 2nd and 3rd Review elements of Chapter 13 PHP and MYSQL for Dynamic Web Sites (ed4) by Larry Ullman.
Changed this to allow for a zero tax rate. I can think of other ways to do this, but this seemed the most straight forward.
I don't really like the way the FILTER_SANITIZE_NUMBER_FLOAT works since I can stick in really strange values as long as a number is included and this will be accepted once it is cleaned. Thus po05 is accepted and comes out as 05. I prefer to use FILTER_VALIDATE_FLOAT with a flag value since anything silly is simply rejected. I have used the former (SANITIZE) in in this example in deference to the book examples.

If the pdf doesn't open, go to Widget price calculator.pdf