Entries tagged ‘PHP’
Yoda Syntax – A Backwards Design Pattern for If Statements
Sometimes the penny drops and you realise there’s a childishly simple solution to a problem that’s been bugging you for years. And no, I’m not talking about my wife, I’m talking about Yoda Syntax.
Have you ever spent far too long hunting down an impossible bug in your PHP only to eventually track it down to [...]
Expanding Short URLs with PHP: expand_url PHP function
URL shortening services work by redirecting a users browser from the shortened URL to the actual target URL. Some of these services provide means of reversing the shortening process. Some provide API methods for this.
The following function will take a shortened URL, from any service, and return the original URL. As it works by inspecting [...]
Create Short URLs with PHP: shorten_url PHP Function
Do you want to create short urls from within your own PHP application? Most url shortening services provide an API, it’s how apps like twitter clients provide built-in url shortening. I wrote a small PHP function to provide url shortening from two of the most popular services, is.gd and tinyurl.com. Where’s bit.ly I hear you [...]
PHPMailer Bug: Headers showing in message body
PHPMailer is a handy little class which smoothes out the minefiled that is sending email with PHP. Okay, it’s not exactly difficult, but it’s not always striaghtforward either.
I did come across a niggly little bug in the latest release (2.3 at time of writing) which causes a large number of mail clients to incorrectly parse [...]
How to Install cURL support under Uniform Server 3.5 Apollo
Uniform Server 3.5 Apollo is an excellent environment for those of us who, for whatever reason, use Windows for PHP development. Unforunately it comes without cURL support. After a bit of digging I figured out (i’m no linux sysadmin) how fairly simple it is to get cURL up and running with uniserver.
The following assumes that [...]
imagettfbbox() Could not find/open font
This evening I noticed a problem with the script which generates the image headings for this site. It had stopped working. I hadn’t noticed until now because the process caches all previously generated images and as such it hadn’t actually run for a while.
The error
imagettfbbox() [function.imagettfbbox]: Could not find/open font
The specified font file existed and [...]

