$date = "1346706576967"; // miliseconds
$newDate = (int) $date;
echo $newDate;
I am getting "2147483647" as $newDate.
I simply want to convert the variable from String 1346706576967 to int 1346706576967 - how is this possible?
$date = "1346706576967"; // miliseconds
$newDate = (int) $date;
echo $newDate;
I am getting "2147483647" as $newDate.
I simply want to convert the variable from String 1346706576967 to int 1346706576967 - how is this possible?
2147483647 is the largest value an integer can hold unfortunately. You could use a float here instead as a float can accurately hold integer values up to 10000000000000
possible conversions,
$input => 1346706576967
(integer)$input => 2147483647
intval($input) => 2147483647
$input*1 => 1346706576967
settype($input, "integer") => 1346706576967