3v4l.org

run code in 300+ PHP versions simultaneously
<?php $n = 47; //print the last n digits from mysterycode aka greyCode for($k=pow(2,$n)-$n;$k<pow(2,$n);$k++){ //echo tobin($mC[$k], $n)."\r\n<br>"; echo tobin(floatval(binaryToGray($k)),$n)."\r\n"; } function binaryToGray($num) { return $num ^ ($num >> 1); } function tobin($nr,$n){ $cnt = $n;//pow(2,$n); $converted_nr = base_convert($nr,10,2); if (strlen($converted_nr)<$cnt){ return leadZero($converted_nr,$cnt-strlen($converted_nr)-1); }else{ return $converted_nr; } } function leadZero($a,$nrZeros){ return str_pad($a, $nrZeros, "0", STR_PAD_LEFT); }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
10000000000000000000000000000000000000000111001 10000000000000000000000000000000000000000111011 10000000000000000000000000000000000000000111010 10000000000000000000000000000000000000000111110 10000000000000000000000000000000000000000111111 10000000000000000000000000000000000000000111101 10000000000000000000000000000000000000000111100 10000000000000000000000000000000000000000110100 10000000000000000000000000000000000000000110101 10000000000000000000000000000000000000000110111 10000000000000000000000000000000000000000110110 10000000000000000000000000000000000000000110010 10000000000000000000000000000000000000000110011 10000000000000000000000000000000000000000110001 10000000000000000000000000000000000000000110000 10000000000000000000000000000000000000000010000 10000000000000000000000000000000000000000010001 10000000000000000000000000000000000000000010011 10000000000000000000000000000000000000000010010 10000000000000000000000000000000000000000010110 10000000000000000000000000000000000000000010111 10000000000000000000000000000000000000000010101 10000000000000000000000000000000000000000010100 10000000000000000000000000000000000000000011100 10000000000000000000000000000000000000000011101 10000000000000000000000000000000000000000011111 10000000000000000000000000000000000000000011110 10000000000000000000000000000000000000000011010 10000000000000000000000000000000000000000011011 10000000000000000000000000000000000000000011001 10000000000000000000000000000000000000000011000 10000000000000000000000000000000000000000001000 10000000000000000000000000000000000000000001001 10000000000000000000000000000000000000000001011 10000000000000000000000000000000000000000001010 10000000000000000000000000000000000000000001110 10000000000000000000000000000000000000000001111 10000000000000000000000000000000000000000001101 10000000000000000000000000000000000000000001100 10000000000000000000000000000000000000000000100 10000000000000000000000000000000000000000000101 10000000000000000000000000000000000000000000111 10000000000000000000000000000000000000000000110 10000000000000000000000000000000000000000000010 10000000000000000000000000000000000000000000011 10000000000000000000000000000000000000000000001 10000000000000000000000000000000000000000000000
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 10000000000000000000000000000000000000000111001 10000000000000000000000000000000000000000111011 10000000000000000000000000000000000000000111010 10000000000000000000000000000000000000000111110 10000000000000000000000000000000000000000111111 10000000000000000000000000000000000000000111101 10000000000000000000000000000000000000000111100 10000000000000000000000000000000000000000110100 10000000000000000000000000000000000000000110101 10000000000000000000000000000000000000000110111 10000000000000000000000000000000000000000110110 10000000000000000000000000000000000000000110010 10000000000000000000000000000000000000000110011 10000000000000000000000000000000000000000110001 10000000000000000000000000000000000000000110000 10000000000000000000000000000000000000000010000 10000000000000000000000000000000000000000010001 10000000000000000000000000000000000000000010011 10000000000000000000000000000000000000000010010 10000000000000000000000000000000000000000010110 10000000000000000000000000000000000000000010111 10000000000000000000000000000000000000000010101 10000000000000000000000000000000000000000010100 10000000000000000000000000000000000000000011100 10000000000000000000000000000000000000000011101 10000000000000000000000000000000000000000011111 10000000000000000000000000000000000000000011110 10000000000000000000000000000000000000000011010 10000000000000000000000000000000000000000011011 10000000000000000000000000000000000000000011001 10000000000000000000000000000000000000000011000 10000000000000000000000000000000000000000001000 10000000000000000000000000000000000000000001001 10000000000000000000000000000000000000000001011 10000000000000000000000000000000000000000001010 10000000000000000000000000000000000000000001110 10000000000000000000000000000000000000000001111 10000000000000000000000000000000000000000001101 10000000000000000000000000000000000000000001100 10000000000000000000000000000000000000000000100 10000000000000000000000000000000000000000000101 10000000000000000000000000000000000000000000111 10000000000000000000000000000000000000000000110 10000000000000000000000000000000000000000000010 10000000000000000000000000000000000000000000011 10000000000000000000000000000000000000000000001 10000000000000000000000000000000000000000000000

preferences:
165.55 ms | 409 KiB | 171 Q