The way by which PHP can assign a particular data type for any variable is called typecasting. The required type of variable is mentioned in the parenthesis before the variable.
$str = "10"; // $str is now string
$bool = (boolean) $str; // $bool is now boolean
PHP does not support data type for variable declaration. The type of the variable is changed automatically based on the assigned value and it is called type juggling.
$val = 5; // $val is now number
$val = "500" //$val is now string