3v4l.org

run code in 300+ PHP versions simultaneously
<?php function lzw_decompress($binary) { $dictionary_count = 256; $bits = 8; $codes = array(); $rest = 0; $rest_length = 0; mb_internal_encoding("UTF-8"); for ($i = 0; $i < mb_strlen($binary); $i++ ) {$codes[] = mb_ord(mb_substr($binary, $i, 1)); } // decompression $dictionary = range("\0", "\xFF"); $return = ""; foreach ($codes as $i => $code) { $element = $dictionary[$code]; if (!isset($element)) $element = $word . $word[0]; $return .= $element; if ($i) $dictionary[] = $word . $element[0]; $word = $element; } return $return; } function mb_ord($string) { if (extension_loaded('mbstring') === true) { mb_language('Neutral'); mb_internal_encoding('UTF-8'); mb_detect_order(array('UTF-8', 'ISO-8859-15', 'ISO-8859-1', 'ASCII')); $result = unpack('N', mb_convert_encoding($string, 'UCS-4BE', 'UTF-8')); if (is_array($result) === true) return $result[1]; } return ord($string); } echo lzw_decompress('');
Output for 8.5.0 - 8.5.1
Fatal error: Cannot redeclare function mb_ord() in /in/JbmJc on line 26 Stack trace: #0 {main}
Process exited with code 255.
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.4.1 - 8.4.14
Fatal error: Cannot redeclare function mb_ord() in /in/JbmJc on line 26
Process exited with code 255.
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.18, 8.2.0 - 8.2.5, 8.2.26 - 8.2.29, 8.3.14 - 8.3.28
Fatal error: Cannot redeclare mb_ord() in /in/JbmJc on line 26
Process exited with code 255.
Output for 8.1.19 - 8.1.33, 8.2.6 - 8.2.25, 8.3.0 - 8.3.13
Fatal error: Cannot redeclare mb_ord() in /in/JbmJc on line 34
Process exited with code 255.
Output for 7.2.6 - 7.2.33, 7.3.16 - 7.3.33
Fatal error: Cannot redeclare mb_ord() in /in/JbmJc on line 35
Process exited with code 255.
Output for 7.0.0 - 7.0.24, 7.1.0 - 7.1.20

preferences:
60.8 ms | 414 KiB | 5 Q