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…

Online PHP Interpreter

It’s pretty easy to test PHP code. However, sometimes you just need to validate a short snippet of PHP. For example, here at Learn PHP in 24 Hours, we’re constantly writing up short PHP examples. Naturally it’s important they actually work and testing the snippet can feel a little cumbersome considering you may only need [...]

Read this article…

PHP Modulo Tutorial

Modulo math is very important to many fields of study. For example, we perform modulo 12 arithmatic any time we read an analog clock. According to Wikipedia: In mathematics, modular arithmetic (sometimes called clock arithmetic) is a system of arithmetic for integers, where numbers “wrap around” after they reach a certain value—the modulus. PHP modulo [...]

Read this article…

Comment Out PHP

Comments are an important part of any programming language and PHP is no exception. Comments are used to document code (for yourself and/or others) and to comment out php as needed. PHP provides two forms of inline comments and one form for multiline comments. PHP Comment Types by Example: <?php echo "There are comments below [...]

Read this article…

PHP instr() tutorial

instr is a function used to find the first occurrence of a sub-string within a larger string. Unlike ASP or VB, PHP does not use the terminology instr, but instead uses strpos.  Although named differently, strpos has the same basic functionality as instr. strpos syntax: int strpos (string $string1, mixed $string2 [, int $start = [...]

Read this article…

You can learn php in less than 24 hours!

Do you want to take your web skills to the next level? Do you want to make the most of your time? Are you tired of paying someone else to install and write your php scripts? Discover how easy it is to master PHP using Robert Plank’s SimplePHP eBook. Learn PHP in 24 hours or [...]

Read this article…