O'Reilly logo

Core PHP Programming, Third Edition by Leon Atkinson

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

2.3. Variables

Although you've seen variables in the previous pages, you may wonder what they are exactly. Variables in PHP give you access to memory storage in a part of a computer called RAM, or random access memory. RAM is a volatile medium for storing information. That is, it all disappears when you shut off the machine. The computer sees this memory as a long array of memory cells that reside in sequential addresses. In PHP, however, you cannot actually get to memory at this level. You must use a variable. When you assign a value to a variable with $result = 2 + 5, or retrieve the value of a variable with print($result), PHP takes care of matching the variable name you specified with the right piece of memory in RAM.

Every use of a variable ...

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