3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $bytes32 = [144, 204, 205, 119, 77, 176, 172, 140, 110, 162, 222, 255, 14, 38, 252, 82, 118, 138, 130, 124, 145, 199, 55, 162, 224, 80, 102, 141, 140, 57, 194, 36]; $string32 = \pack('C*', ...$bytes32); $string32Utf8 = \mb_convert_encoding($string32, 'ASCII', 'UTF-8'); $bytes70 = [239, 191, 189, 239, 191, 189, 239, 191, 189, 119, 77, 239, 191, 189, 239, 191, 189, 239, 191, 189, 110, 239, 191, 189, 239, 191, 189, 239, 191, 189, 14, 38, 239, 191, 189, 82, 118, 239, 191, 189, 239, 191, 189, 124, 239, 191, 189, 239, 191, 189, 55, 239, 191, 189, 239, 191, 189, 80, 102, 239, 191, 189, 239, 191, 189, 57, 239, 191, 189, 36]; $string70 = \pack('C*', ...$bytes70); $string70Utf8 = \mb_convert_encoding($string70, 'ASCII', 'UTF-8'); \var_dump($string32Utf8, $string70Utf8, $string32Utf8 === $string70Utf8);
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.26, 8.1.6 - 8.1.13
string(32) "???wM???n???&?Rv??|??7??Pf??9?$" string(32) "???wM???n???&?Rv??|??7??Pf??9?$" bool(true)
Output for 8.1.0 - 8.1.5
string(31) "???wM???n??&?Rv??|??7??Pf??9?$" string(32) "???wM???n???&?Rv??|??7??Pf??9?$" bool(false)

preferences:
64.66 ms | 410 KiB | 5 Q