PHP Data Types

Data Type is PHP

Integer

Double

Boolean TRUE / FALSE case insensitive

String (There is no character type in PHP)

 

String can be defined using single quotes or double quotes

In single quoted string newline character or escape sequences or embedded variables are not recognized. But using double quoted strings escape sequence and embedded variable are recognized.

For example

‘Result is: $sum’     displayed as it is

“Result is: $sum”    displayed with $sum value

 

 

Boolean TRUE / FALSE case insensitive

If the expression is in integer context then it evaluates to false if result of the expression is zero else it is true

If the string expression is used in Boolean context then it evaluates to false if the result of the expression is empty string or “0” otherwise its true even “0.0” is true

 

if it’s a double expression then 0.0 evaluates to false otherwise its true