PHP data types are used to hold different types of data or values, including simple string and numeric types to more difficult data types like objects and arrays.
PHP data types are used to create the variables. PHP supports total eight primitive data types with different functionality. See below the data types:
PHP have 8 kind of different data types. All data types do different kind of works.
String: A string is series of characters, where a character is the same as a byte. You can use single or double quotes for print the string.
<?php $a="Hello India"; $b='Hello World'; echo $a; echo "br"; echo $b; ?>
Integer: An Integer is whole number (but without decimals). Integers are subset of real numbers. It is a number between -2,147,483,648 and +2,147,483,647.
- At least one digit (0-9)
- Cannot contain comma or blanks
- Integer must not have a decimal point
- Integer can be either positive or negative
<?php $a = 500; var_dump($a); ?>