The PHP Data Types, like in any programming language, are the abc of computer languages, both for the Web and in the desktop environment; they. In human language we use words to form sentences; while in computer science data types are used to define the elements that make up a logical expression.
The data type in PHP |
The variables
Assigning the data type to the variables in languages like C for example Java, also called "typed", is mandatory; this must be done explicitly! As for PHP, being a pre-compiled language, the data type is implicitly assigned when a variable is created; to find out the type of data in a variable you can use the (get type off) function of PHP.
The primitive data types in PHP
If you can understand the data type concept, you are halfway to becoming a good developer. The PHP primitive data types are:
- Integer (decimal integers) to contain a value ranging (from -2.147,483,647 to 2,147,483,647).
- Float or "floating point" and double; they reach 15 digits of precision after the decimal point; values range from (-17E + 308 to 1.7E + 307) it's based on IEEE 754 standard.
- String (sequences of characters); they must be enclosed in single quotes or double quotes.
- Boolean is a data type that can only express two states (True / False).
Compound PHP data types
The data types of PHP, "compound" are different; I dare say they are data types for advanced uses! Between these:
- Array for (vectors and matrices).
- Object for objects.
- Callable for calls to callback functions.
- Iterable is a pseudo type for iterating through data.
The special data types of PHP
There remain the special data type NULL which indicates the absence of value and Resource for external resources that use (HTTP POST and GET metod API function; with these latest We close the circle on the data types of the PHP language.
Comments
Post a Comment