Type Casting in php

Type Casting in php through that we 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;

Leave a Comment