title: UTF8 to equivalent number in php
body: <p>I've been searching my !!! off trying to find a PHP function to convert UTF8 to the equivalent number. I'm not entirely sure what to call the number (I heard its called an ordinate?) but heres an example: <a href="http://jrgraphix.net/r/Unicode/3040-309F" rel="nofollow">http://jrgraphix.net/r/Unicode/3040-309F</a></p>
  
  <p>Basically I'm trying to read a UTF-8 .txt file in PHP and then save every line in an array, so I can mess around with it.</p>
  
  <p>If anyone can assist me with this it would be highly appreciated, as I am not that familiar with UTF8 yet.</p>
  
  <p>Edit:
  This is what I've got so far:</p>
  
  <pre><code>echo "var TextCharacters = new Array();\n";
  
  $LineArray = array();
  $file_handle = fopen("lesson1.txt", "r");
  
  
  while (!feof($file_handle)) 
  {
    $line_of_text = fgets($file_handle);  
    array_push($LineArray, $line_of_text);
  }
  
  fclose($file_handle);
  
  foreach($LineArray as $s)
  {
      for($i = 0; $i &lt; mb_strlen($s,"utf-8"); $i++)
      {
          $char = mb_substr($s, $i, 1, "utf-8");
          echo "alert(go(" . bin2hex(iconv('UTF-8', 'UCS-2', $char)) . "));";         
      }
  }
  </code></pre>