Arrays (aka hashtables) are jack-of-all-trades in PHP – virtually all data storage is an array (except for objects – which internally don’t differ much – but let’s leave them alone). However, all array functions are flat – one-dimensional. What if we had some functions for non-flat array operations? One example – let’s suppose we have an array representation of a table:
$arr = array(
Now, how do I get the first row? Oh, that’s easy –
$arr! Now, how do I get the first column? Oops… No good way to do that. Maybe we’d have a function for that? The function, sadly, doesn’t have a good way for that either, but at least it can do it faster.
Then, of course, there’s a whole world of matrices, etc., but that’d be another story.