Read the Manual!

I’ve been coding PHP for several years now.  Granted, I’ve learned a lot by taking apart other people’s scripts and applications over the years, but there is still no substitute for reading the manual!

It may seem boring or a waste of time, but if you want to be good, take some time at least once a week and read through the PHP Function Reference.  The reason this is so helpful is that the more functions you can expose your mind to and the more often you do it, the more likely you’ll know what function to use to accomplish your task at hand.  It’s been said many times that with any programming language, there are at least a half dozen ways to accomplish something — PHP is no different.  So chances are there’s a built-in function to do what you need.

If you don’t really know where to start, I’d suggest starting with Strings or Variables then move on to Arrays.  One thing you’ll start to notice as you read the examples is that most functions will reference other similar or complementary functions.  And you can click back and forth between functions as you build a grasp of how to do different things in PHP.

Also, at the bottom of nearly every function will be many user-contributed comments with code snippets, etc.  These are a great way to learn how to use the function in question or even ways to mimic that function but with more power or flexibility.

Don’t try to force yourself to learn the exact syntax for every function, the main goal is to familiarize yourself with what the various functions do so that when you need one, you’ll at least know where to look.

I hope that somebody gets some value from this first post.  And I hope that future posts will be even more useful as I find other ways to let some of the code-induced steam out of my noggin.  Thanks!