You can pretend that a variable or value is of a different type by using a type cast.This
feature works identically to the way it works in C.You simply put the temporary type in
parentheses in front of the variable you want to cast.
For example, you could have declared the two variables from the preceding section
using a cast:
$totalqty = 0;
$totalamount = (float)$totalqty;
The second line means “Take the value stored in $totalqty, interpret it as a float, and
store it in $totalamount.”The $totalamount variable will be of type float.The cast
variable does not change types, so $totalqty remains of type integer.
You can also use the built-in function to test and set type, which you will learn about
later in this chapter.