PHP Data Types

Variables are those which can store data of various types and these various data types can do many things. There are few variables that PHP support:

  • String
  • Integer
  • Float
  • Boolean
  • Array

1. Strings:
This is sequence of characters which can be put in whether double quotes or single quotes.
Example:

Result:

2 Integer:

Integers are whole numbers in which there would be no decimal. It should have atleast numeric digit, do not include any comma or blank space, can be positive or negative but not any decimal part and it can only be expressed in decimal, hexadecimal and octal decimal .
Example:

Result:

3 float:

This can be presented in decimal format or in exponential form.
Example:

Result:

4 Boolean:

It have two optional with them one is true and another is false.
Syntax:
$a=TRUE;
$B=FALSE;

5 Array:

It can easily store multiple values in single variable.

Example:

Result:

Leave a Reply

Your email address will not be published.