I am facing issue while I convert 10 digit decimal to binary. When I convert up to 9 digits it perfectly works at the same time when I use decbin() function for 10 digit long it doesn't work.
For an example when I convert decimal to binary using decbin() this function with any inputs up to 9 digits then I will get proper out. When I use 10 digit decimal I getting same output (1111111111111111111111111111111
) for numbers between 2200000000 - 9999999999
as input.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>test</title>
</head>
<body>
<?php
$num = $_GET[n];
$bin = decbin($num); // Decimal to binary
?>
<table>
<tr><td>Number:</td><td><?php echo $num; ?></td></tr>
<tr><td>Binary:</td><td><a href='binary.php?b=<?php echo $bin; ?>'><?php echo $bin; ?></a></td></tr>
</table>
</body>
</html>
When I visit number.php?n=2200000845
it shows 1111111111111111111111111111111
as result.
Anyone please solve this problem..