String casting php dan mengapung ke bilangan bulat
<?php
// Converting float to integer
$x = 23.72;
$float_int = (int)$x;
echo $int_cast;
/* This outputs 23. From this, we observe that the floor is calculated of the
float and not rounding or ceiling of the float*/
echo "<br>";
// Converting string to integer
$x = "62.924";
$int_cast = (int)$x;
echo $int_cast;
/* This outputs 62. From this, we observe that the floor is calculated of the
float and not the rounded number or ceiling of the string*/
// Converting string to integer
$x = "Text";
$int_cast = (int)$x;
echo $int_cast;
/* This outputs 0. From this, we observe that if the string contains text,
it outputs*/
?>
Rick Astley