Page 80 - Open Soource Technologies 304.indd
P. 80
Unit 6: Building Blocks of PHP
$_POST[]. An array that includes all the POST variables that PHP received from the client browser. Notes
$_COOKIE[]. An array that includes all the cookies that PHP received from the client browser.
$_ENV[]. An array with the environment variables.
$_SERVER[]. An array with the values of the web-server variables.
“How to Write a Web Application with PHP.” On a language level, it is important to know
that you can access these variables anywhere in your script whether function, method, or global
scope. You don’t have to use the $GLOBALS[] array, which allows for accessing global variables
without having to predeclare them or using the deprecated globals keyword.
6.1.2 Data Types
Eight different data types exist in PHP, five of which are scalar and each of the remaining three
has its own uniqueness. The previously discussed variables can contain values of any of these
data types without explicitly declaring their type. The variable “behaves” according to the data
type it contains.
6.1.2.1 Integers
Integers are whole numbers and are equivalent in range as your C compiler’s long value. On
many common machines, such as Intel Pentiums, that means a 32-bit signed integer with a range
between –2,147,483,648 to +2,147,483,647.
Integers can be written in decimal, hexadecimal (prefixed with 0x), and octal notation (prefixed
with 0), and can include +/- signs.
Some examples of integers include
240000
0xABCD
007
-100
As integers are signed, the right shift operator in PHP always does a signed
shift.
6.1.2.2 Floating-Point Numbers
Floating-point numbers (also known as real numbers) represent real numbers and are equivalent
to your platform C compiler’s double data type. On common platforms, the data type size is
8 bytes and it has a range of approximately 2.2E–308 to 1.8E+308. Floating-point numbers include
a decimal point and can include a +/- sign and an exponent value.
LOVELY PROFESSIONAL UNIVERSITY 75