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);

preferences:
45.41 ms | 402 KiB | 5 Q