3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Dec2Bin($number) { while ($number >= 256) { $bytes[] = (($number / 256) - (floor($number / 256))) * 256; $number = floor($number / 256); } $bytes[] = $number; for ($i=0;$i<count($bytes);$i++) { $binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, "0", STR_PAD_LEFT)).$binstring; } return $binstring; } $float = PHP_FLOAT_MAX; $bin = Dec2Bin($float); $length = strlen($bin); echo $bin . PHP_EOL; echo $length .PHP_EOL; echo $length / 8;

preferences:
25.67 ms | 404 KiB | 5 Q