<?php
error_reporting(-1);
mb_internal_encoding('utf-8');
header("Content-Type: text/plain; charset=utf-8");


function getUtf16Symbols($str) {
    //convert to utf-16be
    $str = iconv("utf-8","utf-16be", $str);
    $symbolList = [];
    for ($i = 0; $i < strlen($str); $i += 2) {
        $symbolList[] = $str[$i] . $str[$i+1];
    }
    return $symbolList;
}

function getUtfCodepoint($char) {
    $h = dechex(ord($char[0]))  . dechex(ord($char[1]));
    return  strtoupper("U+" . sprintf("%04s", $h));
}

$str = "019azAZаяАЯ $ ½";
echo "String - $str\n";

echo "Codepoints list:\n";

$originalSymbols = preg_split("//u", $str, null, PREG_SPLIT_NO_EMPTY);
$utf16Symbols = getUtf16Symbols($str);

for ($i = 0; $i < count($originalSymbols); $i++) {
    echo $originalSymbols[$i] . " - ";
    echo getUtfCodepoint($utf16Symbols[$i]) . "\n";
}