One of the reasons I LOVE WordPress is that it makes some mundane programming chores very easy, particularly working with the database. WP uses a modified version of the ezSQL to interact with the database, and provides a number of data cleansing functions, both of which are huge time savers. One other thing that WP […]
Archive | PHP

PHP – Sort a Multi-dimensional Array by Value for a Key
Here’s a problem I’ve run into a time or two with sorting arrays. I had a multi-dimension array that I needed to sort on a the values for a specific key (“name” in this case). This array is similar to what you would get back from a mysql database query when you use ARRAY_A to […]

OOP PHP: What is the Double Colon in Objects/Classes for?
I happen to be the only PHP programmer that I know, so it’s hard to ask your buddy what the heck that :: is used for in some OO PHP programs. I know you could post it on a forum and get the answer, but I never did. And Google wasn’t really forth coming when […]
PHP: Using Switch to test Multiple Conditions
Ok, so maybe this is common knowledge, but I still felt a little clever when I figured out this trick. The situation was that I wanted to test a bunch of different conditions to figure out which time category a date falls into. It would be fairly simple to do with a bunch of if…then…else’s, […]
PHP: Capture Included File Contents to Variable
I banged my head against several walls on this a while back and finally gave up. Today I found this post over at bin-co.com describing how to capture the contents of an include file to a variable. Here’s the code…thanks Binny! | The code:
PHP: Proper Case Function for PHP Strings
Yes, PHP does have a proper case function for strings: ucwords($string) If you’re looking for the lower and upper case string functions…here you go: strtolower($string); strtoupper($string); Why not a strtoproper(), just to keep it consistent? Well, consistency here wouldn’t exactly be consistent for PHP, would it 😉 ?
PHP: What is the & Ampersand Preceding Variables
Well, this one is hard to find on Google, so I’m putting it in WhyPad to make it easy to find…at least for me, and I guess for you too since you here. Welcome! You may see PHP code snippets (PHP 5+ only) that have an ampersand, ‘&’, preceding a variable like &$my_variable. So, what […]

Codeigniter: ActiveRecord Join Tip
I ran into a problem with a SQL JOIN in Codeigniter’s ActiveRecord class. This post will help you get past that, but first a little intro to frameworks. If you’re a PHP developer, you have probably considered one of the incredibly useful frameworks that are available today. Cake, Zend, Symfony, and Codeigniter are some of […]