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('Isnt this cool?');
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.19, 7.3.21 - 7.3.25, 7.3.27 - 7.3.28, 7.3.30 - 7.3.31, 7.4.3 - 7.4.13, 7.4.15 - 7.4.21, 7.4.23 - 7.4.25, 7.4.27 - 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.5 - 8.3.7
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 31457288 bytes) in /in/0Jv7t on line 17
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/0Jv7t on line 17 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/0Jv7t on line 17 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 7.3.32, 7.4.26, 8.0.13
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65011720 bytes) in /in/0Jv7t on line 17
Process exited with code 255.
Output for 5.6.38, 7.1.22, 7.2.10, 7.3.20, 7.3.26, 7.3.29, 7.3.33, 7.4.14, 7.4.22

Process exited with code 137.

preferences:
143.14 ms | 402 KiB | 144 Q