3v4l.org

run code in 300+ PHP versions simultaneously
<?php $num = 11; $base = 2; $stack = []; while( $num > 0) { array_push($stack,($num % $base)); // pushes remainder on stack $num = (int) ($num/$base); // no integer division } while($stack) { echo array_pop($stack); // 1011 in final iteration } echo "\n";

preferences:
32.26 ms | 402 KiB | 5 Q