O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites 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

Variable Creation and Scope

Although you've seen variables in the previous pages, you may wonder what they are exactly. Part of a computer is called RAM, or random access memory. This 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 string of single characters, or bytes, each numbered. In PHP, however, you cannot actually get to memory at this level. You must use a variable. You provide a name, and PHP takes care of matching the name to physical memory.

Listing 2.2. Experimenting with Scope
						
							
								
							
						
					

You do not need to let PHP know about a variable before you ...

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