3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP FUNCTION bin2text($bin_str) { $text_str = ''; $chars = EXPLODE("\n", CHUNK_SPLIT(STR_REPLACE("\n", '', $bin_str), 8)); $_I = COUNT($chars); FOR($i = 0; $i < $_I; $text_str .= CHR(BINDEC($chars[$i])), $i ); RETURN $text_str; } FUNCTION text2bin($txt_str) { $len = STRLEN($txt_str); $bin = ''; FOR($i = 0; $i < $len; $i ) { $bin .= STRLEN(DECBIN(ORD($txt_str[$i]))) < 8 ? STR_PAD(DECBIN(ORD($txt_str[$i])), 8, 0, STR_PAD_LEFT) : DECBIN(ORD($txt_str[$i])); } RETURN $bin; } PRINT text2bin('Isn\'t this cool?'); ?>
Output for 7.0.0 - 7.0.6, 7.1.0 - 7.1.20, 7.2.10 - 7.2.12, 7.2.29 - 7.2.33, 7.3.0, 7.3.16 - 7.3.26, 7.3.29 - 7.3.31, 7.4.4 - 7.4.13, 7.4.15 - 7.4.21, 7.4.23 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.1, 8.1.28, 8.2.18, 8.3.6
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 31457288 bytes) in /in/BoTqN on line 18
Process exited with code 255.
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 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 31457288 bytes) in /in/BoTqN on line 18
Process exited with code 255.
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Out of memory (allocated 18874368 bytes) (tried to allocate 14680072 bytes) in /in/BoTqN on line 18 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.1.2 - 8.1.27
Fatal error: Out of memory (allocated 18874368) (tried to allocate 14680072 bytes) in /in/BoTqN on line 18 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 8.0.13
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65011720 bytes) in /in/BoTqN on line 18
Process exited with code 255.
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.20, 7.1.25, 7.2.1 - 7.2.9, 7.2.13, 7.3.1, 7.3.27 - 7.3.28, 7.4.3, 7.4.14, 7.4.22

Process exited with code 137.
Output for 7.2.0
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 31457288 bytes) in /in/BoTqN on line 18
Process exited with code 137.

preferences:
189.26 ms | 401 KiB | 241 Q