Archive for the 'PHP' Category

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: 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:

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. [...]

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 [...]