Saturday, March 8, 2014

PHP Data Types

PHP has seven data types :-

1) string
2) integer
3) float
4) boolean
5) array
6) object
7) resource

*) string


Strings hold characters such as "a" "hello" "Mahi Babariya" etc.
PHP strings are case-sensitive.

*) integer


Integers hold whole numbers, either positive or negative, such as 1, -20, 12345,etc.
The limit of integer is between -2147483647 and 2147483647.
The integer numbers outside the range are automatically converted to floats.

*) float


Floats hold fractional numbers as well as very large integer numbers, such as 2.5, 1.00000001, and 12345.67890

*) Boolean


Booleans hold either true or false. Behind the scenes, booleans are integers.

*) Array


Arrays are a special variable type in that they hold multiple values like a container.

*) object


Objects are complex variables that have multiple values, and they can have their own functions.

*) resource


Resources might be picture data, or the result of an SQL query. We should free up resources after using them.

No comments:

Post a Comment