If it got a little brutal back there trying to make sense of my functions, don't
worry you'll probably get used to squinting through other people's code once
you get going. That's because somebody has probably written code for
whatever you need to do already, and is probably happy to share it with you. Making sense
of it all gets easier and easier the more you use this stuff. And since PHP
is an open-source language (meaning the source code is shared openly instead
of being hoarded by an evil corporation), the language is surrounded by a sense
of cooperation among its users, many of whom will help you if they can.
With the knowledge that you have so far, you can go almost anywhere with this
PHP business. But how do you find out out to do a particular task that you need
to do? Here are some good resources. These are just places that I frequent,
but by no means is this a comprehensive list:
PHP.net
As I've mentioned, PHP.net is the language's central brain. Here are parts of
PHP.net that I've found especially useful.
Manual: The site contains a general manual for PHP. Some functions may take
a while to figure out, but it's all here. Once at PHP.net, follow the links
to Documentation --> View Online and pick your language.
Function List: At the top of the main php.net page you'll find a search box
in which you can search different areas of the site. If there's a function you
need to find, search through the functions there. Often you'll have to search
for a word ("cookie") and then figure out from the results which function
is what you want ("setcookie").
FAQ: Find great info in the FAQ, including a category titled "Common Problems."
Our PHP collection
PHP Knowledge Base
PHPBuilder
Recommended Reading
I bought several books when I started learning PHP that were of varying quality.
I really liked Larry Ullman's "PHP for the World Wide Web" (Peachpit
Press). "Teach Yourself PHP4 in 24 Hours" by Matt Zandstra was also
good. Books published by O'Reilly are also generally excellent, though I haven't
seen theirs on PHP.
How to Write Your Code
No matter what source you use for reference material (and you'll need sources!),
there's a general rule of thumb to use when writing this stuff. It's always
good to map out what you need to do and then test your concept as simply as
possible. Once you get the machinery working, you can put in your real content
and make it more and more complex. It's much harder to troubleshoot if you don't
start out with simple pieces.
Enough of my blabbing. I hope you found this tutorial useful. Please feel free
to email me if any parts were unclear or if you want to name your children after
me. And just remember, the key ingredient to building any great website is
love! Toodles!