-
Learning PHP - Part 6: Functions
Posted on November 3rd, 2009 No commentsFunctions are a very important PHP feature, and are the building blocks to some very powerful programming techniques. First of all, what is a function?
In the tutorials so far, the PHP scripts have run from the top down. All instructions are performed in the order they appear in the file.
A function can be thought of as a reusable ‘black box’. You (optionally) give it some data (called arguments or parameters), it performs an operation and (optionally) gives you a result.
This is illustrated in the following diagram:

-
Learning PHP - Part 5: Your first dynamic web page
Posted on November 3rd, 2009 No commentsAfter the previous parts of this tutorial, you should be familiar with PHP variables and arrays.
Now we will use these concepts to actually make a working web page. This page will contain a form that you can submit, and we will write PHP code to handle the form contents.
-
Learning PHP - Part 4: Controlling flow
Posted on November 2nd, 2009 No commentsSo now we’ve looked at variables and arrays, it’s time to make the code a little bit smarter.
We’ve already seen how the foreach() can loop (iterate) over items in an array, but there are other ways to alter the flow of the code as well.
Conditional
One of the most common PHP statements is the “if”. In a nutshell, “if” does the following:
if (some condition is true) { run this code }
-
Symptoms of a Wordpress Hack
Posted on November 2nd, 2009 2 commentsI came to my site on Sunday morning ready to write the latest in my PHP tutorial, only to find a nasty looking 500 server error. I couldn’t even log into the admin panel.
After a while tinkering with various configuration settings and trying to get something to come up, I started searching the web. Turns out, earlier versions of Wordpress were vulnerable to specific hacks that could let attackers create their own admin users.
