Decimal To Binary
This algorithm converts decimal numbers to binary numbers.
function DecimalToBinary($dec)
{
if ($dec < 1) return "0";
$binStr = "";
while ($dec > 0)
{
$binStr = substr_replace($binStr, strval($dec % 2), 0, 0);
$dec = floor($dec / 2);
}
return $binStr;
}
Example
$data = 6207166;
$value = DecimalToBinary($data);
Output
10111101011011010111110