One of the things that's neat about PHP is that it has all these neat little functions in it that do things... things which you could do in just a few lines of code if you had the inclination, but PHP is nice enough to include them for you. It makes working in a generally unpleasant language somewhat more pleasant.
For instance, I have a function in one of my "model"s return a list of categories for my weblog. It returns it as an associative array mapping category ids to category names. For an API I'm writing for something else, I wanted it in the opposite order, mapping category names to category ids. array_flip is one of those simple things I'm talking about.
Unfortunately, the impression I get is that people don't generally get a handle on all of the functions that exist, and IIRC I often see people writing code to do what a built-in function does. The manual is your friend.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):