Category Archives: PHP

Crushing Code and Shaving Chars

Who has heard of Code Golf? I hadn’t up until about 3 years ago when I first stumbled across some on Stack Overflow. I faintly recall the horror as I gazed upon some of the most cryptic code ever – … Continue reading

Posted in Just for fun, PHP | Tagged , , , , , | 3 Comments

n Parts for Sum in PHP

I was bouncing around on Stack Overflow, answering questions here, voting on questions and answers there, when I came across a question on how to construct an array of arbitrary size, whose members add up to an explicit sum. This … Continue reading

Posted in PHP, StackOverflow | Tagged , , | Leave a comment

prependChild on DOMElement in PHP, Sort of.

This evening I wanted to add a new LI onto a WordPress navigation programmatically. After considering a few different options, I decided I wanted to use PHP’s DOMDocument, and use this as an opportunity to more familiarize myself with its … Continue reading

Posted in PHP, WordPress | Tagged , , , , , , | Leave a comment

Todays WTF Moment with CodeIgniter, MySQL and PHP

As routine as an oddly-twitching finger sabotaging any attempt to use your mouse, strange things  may take place with your environment, tools, or code. Today I was working on setting up a very small project with CodeIgniter when I came … Continue reading

Posted in CodeIgniter, MySQL, PHP | Tagged , , , , , , , , | 1 Comment

A Shorter Ternary Operator in PHP 5.3

The ternary operator is simply awesome. It allows for some really beautiful if-else style variable assignments: $can_drink = ( $age <= 21 ) ? true : false ; This operator let’s you evaluate a condition, and return one of two … Continue reading

Posted in PHP | Tagged , , | 2 Comments