datatypes.php with examples /* PHP supports the following data types: * String * Integer * Float * Boolean * Array * Object * NULL * Resource * note that var_dump($x) displays type and value */ String examples
Hello world!
Hello world!
Integer examples
int(5985) int(-1) 5985
-1
oct 0123 = 83
hex 0xfff = 4095
bin 0b1111 = 15
Float examples
float(10.365) float(-0.001) float(75000000000) x= 10.365
y= -0.001
z= 75000000000
Boolean examples
1Array examples
array(3) { [0]=> string(5) "Volvo" [1]=> string(3) "BMW" [2]=> string(6) "Toyota" } array(6) { [0]=> int(2) [1]=> int(3) [2]=> int(5) [3]=> int(7) [4]=> int(11) [5]=> int(13) } Object example
VWNull example
NULL Resource example
PHP Resource
The special resource type is not an actual data type.
It is the storing of a reference to functions and resources
external to PHP.
A common example of using the resource data type is a database call.