O'Reilly logo

PHP for Teens by Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Variables

Variables are the backbone of any programming language—but what is a variable? All variables contain a value that you can change throughout the program. What can a variable hold? Well, anything really. If you want to track who last visited your site to use the form, you can store the visitor’s name inside a variable. If you want to create a message board, a variable can save the message that is to be posted.

Types

There are numerous types of variables, and they’re listed in Table 4.1. Each type stores a different type of data. For example, PHP draws a distinction between the number 343 and 343.14. PHP handles them different ways, so you can get some weird results when you try to divide a whole number by a fraction, for instance.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required