What are Data Types in PHP ?
A data type is a classification identifying one of various types of data, such as real, integer or Boolean, that determines the possible values for that type, the operations that can be done on values of that type, the meaning of the data, and the way values of that type can be stored in other words A particular kind of data item, as defined by the values it can take, the programming language used, or the operations that can be performed on it. Likewise all other language PHP also have data types.
Data Type in PHP.
- Data type in PHP are of intrinsic. It means no explicit declaration is need for the variable in PHP .
- Variable name must have a prefix “$“(dollar sign ) .
- Variable name must follow rules for an identifier and should not start with Number.
- Use ‘\‘as prefix to variable name to skip it from being interpolated. ‘\’ is called Escape sequence.
- To know the Type of data type gettype function can be used .
eg. gettype(variable); /// it returns the data type of variable
- We Can have double and single quotes string in PHP.
- Single quote string does not contain interpolation
- PHP support following type of Data Types
- Float (floating point numbers – also called double)