PHP: String to full ASCII
<p>I'm using an RTF converter and I need <code>240</code> as <code>&amp;#U050&amp;#U052&amp;#U048</code> but Im not to sure how to do this!?!</p>

<p>I have tried using the following function:</p>

<pre><code>function string_to_ascii($string) {
    $ascii = NULL;
    for ($i = 0; $i &lt; strlen($string); $i++) {
            $ascii += "&amp;#U"+str_pad(ord($string[$i]),3,"0",STR_PAD_LEFT);
    }
    return($ascii);
}
</code></pre>

<p>But it still just outputs just the number (e.g. <code>2</code> = <code>50</code>) and <code>ord</code> just makes it go mad.</p>

<p>I've tried <code>echo "-&amp;#U"+ord("2")+"-";</code> and I get <code>50416</code> !?!?</p>

<p>I have a feeling it might have something to do with encoding</p>
