PHP DATA TYPES
Variables are used to store different types of data types. The following are 4 simple data types that can be stored in variables.
Character Strings: Can be composed of text, text and numbers or other characters. Examples: John, john25, <b>John</b>
Integers: Positive or negative whole numbers - no fractions. Examples: 456, 0, -200
Floating Point Numbers: Numbers with decimal places. Examples: 25.345, 2.54678899, 0,56666
Boolean: Either a TRUE OR FALSE value.
ASSIGNING DATA TYPES
Unlike other programming languages that require you to declare or initiate a variable first and then assign a value to it, PHP allows you do do it in one go. Example:
$myName="John";
$myAge=38;
$myTaxRate=0.14;
PHP recognizes the values and assigns the proper of the 4 data types automatically without you first having to declare what of the 4 data types it is.
|