How should you think about defining classes? the best approach is to think of a class as having a primary responsibility and to make that responsibility as singular and focused as possible. Put the responsibility into words. It has been said that you should be able to describe a class’s responsibility in 25 words or less, rarely using the words “and” or “or.” If your sentence gets too long or mired in clauses, it is probably time to consider defining new classes along the lines of some of the responsibilities you have described.… More


Learn the PHP Switch Statement

The PHP switch statement is a conditional statement used to select one of many possible blocks of code, which are called cases. By comparing the value of the expression to the value of each defined case, the switch statement will choose the correct block of code to execute.… More


Learn the PHP If Statement

The if statement is one of the most important features of any programming language because it allows you to evaluate expressions and selectively execute blocks of code if the expression evaluates to true. The principal behind the if statement is simply if (expression) is true, then do this or else do something different or nothing at all.… More


Learn PHP Operators

You may be thinking to yourself, why study PHP operators? After all, I think I can figure out what is going on by looking at code examples and I already have a good idea of what it means when I see a plus symbol, minus sign or equals sign.… More


Learn PHP Strings

A string can be created within a function you are using or you can store the string within a variable. The advantage of using a variable is that you can easily use the string multiple times within your script without having to recreate it every time.… More