PHP does not require (or support) explicit type definitions in variable definitions; the variable type is determined based on the context in which the variable is used. In other words, if a string value is assigned to the variablevar,varbecomes a string. If you assign an integer value tovar, it becomes an integer.
An example of PHP's automatic type conversion is the plus sign "+". If any operand is a floating point number, all operands are treated as floating point numbers, and the result is also a floating point number. Otherwise the operands are interpreted as integers and the result is also an integer. Note that this does not change the types of the operands themselves; only how the operands are evaluated and the type of the expression itself is changed.
The allowed casts are:
(binary) conversion will prefix the result with 'b', new in PHP 5.2.1.
Note that spaces and tabs are allowed within brackets
Convertstring(string)literals and variables to binarystring(string):
= (binary) = b"binary string"?>
If you want to change the type of a variable, see settype();
settype—Set the type of variable
bool settype( mixed$var, string$type)Set the type of variablevartotype.
Possible values fortypeare:
ReturnsTRUEon success, orFALSEon failure.
intval(), floatval(), strval(), these three functions can also be converted