title: How can I write arabic text in image in PHP
body: <p>I tried to write an Arabic text in an image with PHP.
  This is my code:</p>
  
  <pre><code>&lt;?php
  
  header("Content-Type: image/png; charset=utf8");
  $im = imagecreatetruecolor(150, 30);
  
  // Create some colors
  $white = imagecolorallocate($im, 100, 255, 255);
  $grey = imagecolorallocate($im, 128, 128, 128);
  $black = imagecolorallocate($im, 0, 0, 0);
  imagefilledrectangle($im, 0, 0, 399, 29, $white);
  
  $font = 'tahoma.ttf';
  $t = strrev('إن الدين عند الله الإسلام');
  $text=utf8_encode($t);
  imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
  imagepng($im);
  imagedestroy($im);
  ?&gt;
  </code></pre>
  
  <p>Thank you.</p>