(PHP 4, PHP 5, PHP 7, PHP 8)
imagechar — 水平地绘制一个字符
   imagechar() 将 char 的首个字符绘制在 image
   标识的图像中,其左上角位于 x,y(图像左上角为 0, 0),颜色为
   color。
  
image由图象创建函数(例如imagecreatetruecolor())返回的 GdImage 对象。
font取值对于内建的 latin2 编码字体可以是:1、2、3、4、5(更高的数字对应更大的字体), 或是通过 imageloadfont() 返回的 GdFont 实例。
x起点的 x 坐标。
y起点的 y 坐标。
char要绘制的字符。
color颜色标识符使用 imagecolorallocate() 创建。
   成功时返回 true, 或者在失败时返回 false。
  
| 版本 | 说明 | 
|---|---|
| 8.1.0 | font参数现在接受 GdFont 
  实例和 int,之前仅接受 int。 | 
| 8.0.0 | image现在需要 GdImage 实例;之前需要有效的gdresource。 | 
示例 #1 imagechar() 示例
<?php
$im = imagecreate(100, 100);
$string = 'PHP';
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// 在左上角打印一个黑色“P”
imagechar($im, 1, 0, 0, $string, $black);
header('Content-type: image/png');
imagepng($im);
?>
以上例程的输出类似于:
 
     