title: How to translate emoji unicode bytes string to appropriate UTF-8 in PHP
body: <p>I have a string which is a unicode representation of the form: '\ud83d\ude01'. How can I translate it to its actual UTF-8 representation: ''?  </p>
  
  <p>I have tried the following code:  </p>
  
  <pre><code>$emoji = '\\ud83d\\ude01';
  
  #Cleanup
  $emoji = str_replace("\\u", "", $emoji);
  
  #Split hex
  $hex_bytes = str_split($emoji, 2);
  $hex_bytes_numbers = array();
  
  #Convert to actual numbers
  foreach($hex_bytes as $hex)
      array_push($hex_bytes_numbers, hexdec($hex));
  
  
  $clean_hex_string = implode(array_map("chr", $hex_bytes_numbers));
  
  #Returns: Ø=Þ
  echo $clean_hex_string . "\n";
  
  #Returns : ?=?
  echo utf8_decode($clean_hex_string);
  </code></pre>