Lesson 8: PHP Indexed Arrays

There are several types of arrays in PHP. Personally, I think “Indexed” arrays are the easiest to start with. An indexed array is like an ordered list of items. For example let’s say you have a grocery list: <?php $groceries[0] = "olives\n"; $groceries[1] = "lettuce\n"; $groceries[2] = "salad dressing";   $arraylength = count($groceries); for ($i […]

Read this article…

Lesson 7: PHP Switch Statements

In lesson 6 we presented the if/else statement. Let’s now look at a very similar statement called the “switch” statement. If/else statements are great for choosing between conditions while a “switch” statement is more suited for choosing between different “cases” or situations. Let’s take a look: <?php $time="midnight"; switch ($time) { case "morning": echo "The […]

Read this article…

Lesson 6: PHP If… Else Statements

Conditional statements add a lot of life to PHP. A conditional statement says something like the following: If you like ice cream you will eat ice cream , otherwise (else) you won’t eat ice cream. This ability to choose between options will make your PHP seem like it can “think” like a human can. In […]

Read this article…

Lesson 5: PHP Operators

At long last, lesson 5! Let’s check out PHP operators. When we’re talking about operators we’re basically talking about “math”. By operator I mean things like multiplication and division signs. As you might imagine there are tons of operators. Certainly enough to get lost in. The reality is, a lot of these you won’t use […]

Read this article…

Email Using PHP

Do you need to send an email using PHP? Fortunately, it’s EASY! Simply use the mail() function. In the simplest form: <?php mail($to, $subject, $body); ?> The $to parameter specifies the receiver of the email. $subject is the topic of the email. Finally, $body is the main text of the email. There are additional optional […]

Read this article…

Lesson 4: PHP Strings

A string is just a sequence of characters. In PHP, strings are enclosed in quotes such as ” or ‘. Strings can be printed or assigned to variables. Let’s take a look at an example. <?php $my_string_variable = "This is a string" . ‘ and so is this’; print $my_string_variable; print "\nHere’s another string"; ?> […]

Read this article…

Using PHP: Echo Array Values and/or View Array Contents

Many times you need to print or echo an array value. Sometimes you may also need to view the entire contents of an array for debugging or other purposes. Let’s take a look at a few different ways of doing this. Using PHP: Echo Array Values One by One If we just need to print […]

Read this article…

Lesson 3: Using PHP In HTML

Well we’ve talked a lot about PHP, but how do we use it in practice? That’s a great question! So let’s take a look at using PHP in HTML. HTML, if you don’t know, is a way for marking up our text and presenting it in a fashionable way to a person surfing the web. […]

Read this article…

Lesson 2: PHP Comments and PHP Variables

I’m getting feedback that you want more lessons. That was just the motivation I needed . Getting Started If you’re just joining us, you may need to review some of the material we’ve already covered 1) Lesson 1: Using PHP for the first time 2) Comment Out PHP Defining Variables Variables are useful for storing […]

Read this article…

Lesson 1: PHP Basics (PHP Hello World)

Do you want to learn php in 24 hours?  The journey starts with the first step.  When most programmers start learning a new language they start with what is called a “Hello, World!” program.  This is a simple program with the goal of printing the text “Hello, World!” to the screen. While the most useful […]

Read this article…