string php ke int
intval($string);
Concerned Chipmunk
intval($string);
$floatValue = 4.5;
echo intval($floatValue) //returns 4
$floatValue = 4.4;
echo intval($floatValue) //returns 4
$floatValue = 4.5;
echo round($floatValue) //returns 5
$floatValue = 4.4;
echo round($floatValue) //returns 4
s = "123";
echo intval(s); // 123
s = "hello";
echo intval(s); //0
method_1:
intval($string);//for string to integer
floatval($string); //for string to float
method_2:
$int = (int)$string;//string to int
$float = (float)$string;//string to float
$num = "3.14";
$int = (int)$num;//string to int
$float = (float)$num;//string to float