title: How to get code point number for a given character in a utf-8 string?
body: <p>I want to get the UCS-2 code points for a given UTF-8 string. For example the word "hello" should become something like "0068 0065 006C 006C 006F". Please note that the characters could be from any language including complex scripts like the east asian languages.</p>
  
  <p>So, the problem comes down to "convert a given character to its UCS-2 code point"</p>
  
  <p>But how? Please, any kind of help will be very very much appreciated since I am in a great  hurry.</p>
  
  <hr>
  
  <p><em>Transcription of questioner's response posted as an answer</em></p>
  
  <p>Thanks for your reply, but it needs to be done in PHP v 4 or 5 but not 6.</p>
  
  <p>The string will be a user input, from a form field.</p>
  
  <p>I want to implement a PHP version of utf8to16 or utf8decode like</p>
  
  <pre><code>function get_ucs2_codepoint($char)
  {
      // calculation of ucs2 codepoint value and assign it to $hex_codepoint
      return $hex_codepoint;
  }
  </code></pre>
  
  <p>Can you help me with PHP or can it be done with PHP with version mentioned above?</p>