PHP Data Types | PHP Examples

PHP Data Types


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.

Data Types:

  1. String
  2. Integer
  3. Float
  4. Boolean
  5. Array
  6. Objects
  7. Resources
  8. Null

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 Example

$a="Hello India";
$b='Hello World';
echo $a;
echo "br";
echo $b;


Hello India

Hello World

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


$a = 500;

Best WordPress Hosting


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price

Leave a Reply

    Waiting for your comments