Two-Dimensional Array Searching in PHP

Tested with PHP 5.3.1

PHP’s array_search function is great! No longer must we single-step through every element of an array to find what we’re looking for. Too bad it only works on single-dimension arrays.

Read more »


I’m starting this blog because, as the title suggests, I have spent a lot of time learning by doing. And it hasn’t been by choice, let me tell you. I’ve been coding in some form or another since grade school, starting with mIRC script. I’ve since moved on to bigger and (arguably) better things. Currently my sights are set on C++, and PHP for web development.

As I have had no formal training, I’m often flying by the seat of my pants when writing code. This flying often consists of Googling, reading APIs and manuals, compiling, failing, repeating until whatever I’m trying comes close enough to working to satisfy me. And I can’t imagine I’m alone in this.

So, when I come across a problem that my poor-man’s autodidact process can’t immediately solve, I’ll throw my solution up here for others who may need some guidance… and possibly just to jog my memory further on down the road when I inevitably break something.