It’s not every day that one needs to search a multi-dimensional array for a key, and return the associated value, but a simple recursive function allows such an action. In a project I was working on recently, I needed to check the status of a record, but the status array was segmented into three main categories.
So I wrote a quick recursive function to handle the task. Please note, the function will only work if all keys are different. No two keys in the multi-dimensional array can be the same! Yes, I said it twice, but to emphasize that it matters.
Read More …
Posted May 20th, 2014 in PHP