In less than 3 months - on August 8th, 2008 - PHP4 reaches end of life. If you still haven’t updated, it’s damn well time to get migration started. PHP5 far better than the previous versions, and if it’s good enough for Yahoo, Facebook and many other huge sites, it’ll probably be a joyride for you too.
I’m sure most people only thing of PHP as a Weblanguage due to be called through a browser. It has however since version 4.3.0 also been possible to use PHP on the commandline - as you do with Perl, Shell scripts and likewise. If you’re using Linux (or an other Unix-like operating system - including Mac OSX) you probably have a few small programs available which can make it a breeze to check if the syntax in all you PHP scripts is correct.
If you have the GD extension available, you can do a few useful things. One of the simple things is getting an image size is a simple matter. You can either fetch the height and width in seperate variables – or even fetch the height and width in a string pre-formatted for use in an image tag.
Here’s the example in source: $load\_ext = get\_loaded\_extensions(); if (!in\_array(gd, $load\_ext)) { echo "GD is NOT available"; die(); } $nikonFile = '.
Within most photos from digital cameras besides the actual image, there’s a little ”information block” call EXIF data. If you have the correct PHP extension installed on your server – the one called ”exif” – it’s pretty easy to read the EXIF data and display them, as you like.
First, let’s check if the extension is available? $load\_ext = get\_loaded\_extensions(); if (!in\_array(exif, $load\_ext)) { echo "Exif is NOT available"; } else { echo "Exif extension is available.
If you’re doing some basic profiling of your PHP scripts, the build-in microtime function can help you make some simple benchmarking fast. Here’s a rough example to show you how it could be used. The doSomething function is the function we want to benchmark. $time = microtime(); $time = explode(' ', $time); $time = $time\[1\] + $time\[0\]; $start = $time; doSomething(); $time = microtime(); $time = explode(' ', $time); $time = $time\[1\] + $time\[0\]; $finish = $time; $total\_time = round(($finish - $start), 6); if ($debug) print ("<p>Processing took approximately $total\_time seconds</p>");