I happened to learn PHP while hacking my own blog. (and plus I’ve had about 20+ years of general programming experience so that helps too)
Writing a function in PHP is sorta similar to C or C++ language. The commands are very similar just more oriented towards the web or internet.
I could probably go on 20+ pages on how to write a function in PHP but heck, I really don’t have time for that so check out this nice blog post by Brandon that shows you how to write a function in PHP and more.
For new developers, especially developers who have never been programmers before, moving from writing simple scripts to writing functions is a process that takes time. I developed in PHP for years before I wrote a single function. I also never found a comprehensive tutorial on how functions work, or how to write them. There’s documentation in the manual, but it’s a bit hard to grasp if you’re new. This article is about writing functions.