3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ords_to_unistr($ords, $encoding = 'UTF-8'){ // Turns an array of ordinal values into a string of unicode characters $str = ''; for($i = 0; $i < sizeof($ords); $i++){ // Pack this number into a 4-byte string // (Or multiple one-byte strings, depending on context.) $v = $ords[$i]; $str .= pack("N",$v); } $str = mb_convert_encoding($str,$encoding,"UCS-4BE"); return($str); } echo ords_to_unistr(array(239));

preferences:
32.86 ms | 402 KiB | 5 Q