note 79971 deleted from function.decbin by bjori
| From: | bjori@php.net | Date: | Fri, 21 Dec 2007 17:13:54 +0000 |
| Subject: | note 79971 deleted from function.decbin by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133863@lists.php.net to get a copy of this message | ||
Note Submitter: niek_dijkhuis at hotmail dot com
----
I've also created a basic decbin function:
<?php
function dec2bin( $num )
{
$hex = $num * 2;
$bin = '';
while( $hex = floor( $hex / 2 ) ){
$bin .= $hex % 2;
if($hex == 1) {
break;
}
}
return strrev($bin);
}
?>
The native function is better; this one has no max