PHP

 Home  Computers & Internet  Web Programming PHP
What is PHP?
Echo
Comments
Variables
Constants
Data Types
number_format()
Character Strings
Mathematical Operators
Comparison Operators
Logical Operators
Joining Strings
explode()
implode()
strtolower()
strtoupper()
strlen()
ucfirst()
ucwords()
strrev()
str_replace()
str_repeat()
trim()
strip_tags()
addslashes()
stripslashes()
strpos()
strrpos()
nl2br()
isset()
unset()
empty()
POST
GET
If Statements
If Else Statements
Elseif Statements
Switch Statements
For Loops
While Loops
Do While Loops
Foreach Loops
File Create
File Open
File Read
File Write
File Delete
fgets()
file_get_contents()
Date & Time
$_SERVER
Sessions
Cookies
Arrays

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.

Home | Privacy Policy | Terms Of Use | Contact Us