Data Types

String

$client = "Client A";
echo $client;
Client A

Integer

$amount = 10;
$tax = "2"; // parsing of string to int happens automatically
echo ($amount + $tax);
12

$amount = 10;
$tax = "2ab"; // digits at the start, will be taken and parsed into integer automatically
echo ($amount + $tax);
12

Decimal

$amount = 100.1556;
echo round($amount);  // use built-in round function without specifying decimals, will output int part only
echo round($amount, 2);  // round to two decimal places
echo abs($amount);  // returns all decimal places as is
100
100.16
100.1556

Boolean

$active = true; // we can write both true or TRUE
echo ($active) ? "Active" : "Inactive";
Active

Date and Time

Please visit Date and Time page.