shadowline
Print / Echo << Variables >> Numbers - Math
Variables are containers. Think of an ordinary box that you put stuff into. That box may have a label on it so you remember what is inside of it. Variables are boxes that you put data information into. They are labeled with names.

Once you have some information in variables, it can be sorted, organized, manipulated, and so forth.

A variable name starts with a dollar $ symbol. After that you can use any combination of higher case letters A-Z, lower case letters a-z, or the underscore character _. Spaces are not allowed.

Variable names are CaSe SeNsItIvE. If you are referring to a variable in your coding, make sure the name matches exactly.
$MyVariableName is different from $myvariablename.

Variable names should be easy to understand. Give some thought into the names.
$fn or $FirstName or $first_name
Which one looks more easier to understand and remember?

There are three types of variables. Numbers, Strings, and Arrays.

Number Variables may contain integers (regular positive or negative numbers) or floating-point (decimal) numbers. No fractions, letters, or extra decimals allowed.

$integer_example = 5;
$floating_point_example = 365.25;

String Variables are word variables. They may contain number information and other variables. The values of string variables are contained within single quotes ' ' or double quotes " " depending on how you want to use them.

$string_example_1 = "This is a test.";
$string_example_2 = 'This is another test.';
$string_example_3 = "5";
$string_example_4 = "The value is $integer_example.";
$string_example_5 = 'The value is $integer_example.';

The difference between single and double quotes is : Single quotes will print out the exact value of the string as is. Double quotes will transfer variable values into place before printing.

echo "$string_example_4 <br />";
echo "$string_example_5";

Outcome :
The value is 5.
The value is $integer_example.

Arrays are groups of variables. These will be discussed in more detail on their own page.
Print / Echo << Variables >> Numbers - Math
shadow

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads
shadow
shadow