What data types does Php support ?

Data Types define the data type that can be stored by a variable. PHP enables eight distinct data types. All of them will be discussed below. The first five are called easy data types and the last three are kinds of compound data types.


Integers only keep whole figures with favorable and bad figures, i.e. numbers without fractional portion or decimal point. They may be decimal (10 base), octal (8 base) or hexadecimal (16 base). Decimal is the standard foundation (base 10). The octal integer with leading 0 can be stated and the hexadecimal with leading 0x can be stated.


Hold letters or any alphabets, even numbers are included. These are written within double quotes during declaration. The strings can also be written within single quotes but it will be treated differently while printing variables.


Hold either TRUE or FALSE only two values. Successful occurrences will make real and failed occurrences fake. The values of the NULL type are also treated in Boolean as false. Other than NULL, 0 in Boolean is also considered to be false. If a string is empty then it is also considered as false in Boolean data type.


Objects are identified as user-defined class cases capable of holding both values and features. This is a sophisticated subject and in further papers will be discussed in detail.


Array is a data-type compound that can store multiple data-type values.


PHP resources are not a precise sort of information. Basically, these are used to store references to some function call or external PHP resources. Consider, for instance, a call from the database. This is a resource from outside.

PHP also has a NULL and resource sort in relation to the data types mentioned above. If no value has been allocated to a variable, it has been explicitly set to NULL, or has become unset. When php developers interact with documents and databases, you may run into the resource sort as the features in PHP often use a resource when opening a file to read or link to a database.

M'abonner aux flux %KW% sur %NDD%.