You cannot exceed PHP_INT_MAX
$num = "96435171263250434";
$x = (float) $num; // This should hold it but it's a float
$maxIntMult = 0;
$maxIntMult = intval($x / PHP_INT_MAX);
$remainder = $x - $maxIntMult * PHP_INT_MAX;
echo PHP_INT_MAX . " x " .$maxIntMult. " + " . $remainder; // function of two integer if you can't work with floats and you can make something of this
You can try to make use of the fact that ids don't have negative values, effectively doubling your range.
$num = PHP_INT_MAX + 50;
$x = (float) $num;
$intX = $num - PHP_INT_MAX;
echo $intX; // Shows 50 with the '0' being -PHP_INT_MAX
function getIdWithNonZeroOffset($stringId)
{
$x = (float) $stringId;
$intX = $x - PHP_INT_MAX;
return $intX;
}
function getStringFromNonZeroOfssetId($id)
{
return (string) ($id + PHP_INT_MAX);
}
echo getIdWithNonZeroOffset((string)(PHP_INT_MAX + 200)); // Gives 200 (store this in int column)
echo getStringFromNonZeroOfssetId(200); // Gives "2147483847" (my max int is "2147483647")
intval()function? It returns the integer value of a string.