3v4l.org

run code in 300+ PHP versions simultaneously
<?php // convert decimal to base 2 without using base_convert $base = 2; $num = 23; while( $num > 0) { $arr[] = $num % $base; // store remainder in array $num = floor($num/$base); // no integer division } var_dump($arr); $cat = join('',array_reverse($arr)); var_dump($cat);

preferences:
42.2 ms | 402 KiB | 5 Q