php string to int
snippet in php

php string to int

user7841

intval($string);

php float to int

user7062

$int = intval($float);

cast string to int php

user7088

$num = "3.14"; 
$int = (int)$num;//string to int
$float = (float)$num;//string to float

convert to int php

user3487

$myintvariable = intval($myvariable);

php to int

user3225

$num = "3.14";
$int = (int)$num;

transforming string to integer in php

user4142

Using intval() and floatval() Function. The intval() and floatval() functions can also be used to convert the string into its corresponding integer and float values respectively. echo floatval ( $num );