Showing posts with label Special types. Show all posts
Showing posts with label Special types. Show all posts

Saturday, 18 June 2016

PHP Data Types

PHP Data Types


Variables can store data of different types, in PHP we do not need define the type of variable, its define automatic at run time.

If we assign  string in a variable, then it becomes a string.
$value="Hello PHP"; // String

Later if we assign an integer value, the variable becomes an integer variable.
$value=10; // integer


 PHP has eight data types:-


Scalar types:
1). Boolean ( It can be either TRUE or FALSE. )
2). Integer (An integer is a "number of set:  n = {...,-3, -2, -1, 0, 1, 2,3, ...}. )
3). Float ( Floating-point number,)
4). String    (Group of characters, like "Hello PHP".)

Compound types:
5). Array (An array is a group of values in one single variable)
6). Object (An object stores data and  code,  its store  information about  how to process that data.)

Special types:
7). Resource ( Holding a reference to an external resource.)

8). NULL (it is a variable that has no value assigned to it)