0% found this document useful (0 votes)
88 views1 page

04 - Variables

PHP variables allow storing and reusing data of any type like numbers, strings, objects, and arrays. A variable is declared with a dollar sign followed by the name, like $var_name, and can be set to a value that can later change. Variable names must begin with a letter or underscore, can include letters, numbers, and underscores, but not spaces.

Uploaded by

Sourabh Bhandari
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views1 page

04 - Variables

PHP variables allow storing and reusing data of any type like numbers, strings, objects, and arrays. A variable is declared with a dollar sign followed by the name, like $var_name, and can be set to a value that can later change. Variable names must begin with a letter or underscore, can include letters, numbers, and underscores, but not spaces.

Uploaded by

Sourabh Bhandari
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

PHP Variables

A variable can store the value of any data type. The variable can be declared as follows: $var_name = value; All variables in php must be preceded by a dollar sign ($). A variable can store value of any data type ie. Numbers, string of characters, objects, arrays or boolean. The value of variable can be changed at any time and can be used over and over again in a script. Let us see a script below to demonstrate usage of variable: <?php $var = Hello World; echo $var; ?> Rules for naming variables: 1. 2. 3. 4. A variable name is always preceded by dollar sign ($). A variable name can include letters, numbers and underscores (_). A variable name must not contain any spaces. A variable must begin with letter or underscore (_).

Check our more tutorials at http://unettuts.com

unettuts, 2011

http://unettuts.com

You might also like