Type casting to integer
Type casting to integer can be done using
two way
(i) The name of the desired type is written in parentheses
(ii) Converting to integer using function intval()
1.The name of the desired type is written in parentheses
<?php
$int1 = 10;
$int2 = (int) 10;
// OR
$int2 = int(10);
?>
2. Converting to integer using function intval()
<?php
$ab = ‘123.44′;
echo intval($ab); // will output 123
?>
