This example shows how to display dashed line in php gd.
This example shows how to display dashed line in php gd.<?php
header("Content-type: image/png");
$width = 350;
$height = 360;
$im = ImageCreateTrueColor($width, $height);
ImageAntiAlias($im, true);
$white = ImageColorAllocate($im, 255, 255, 255);
ImageFillToBorder($im, 0, 0, $white, $white);
$black = ImageColorAllocate($im, 0, 0, 0);
ImageLine($im, 10, 10, 250, 300, $black);
ImageDashedLine($im, 30, 10, 280, 300, $black);
ImagePNG($im);
ImageDestroy($im);
?>
After running the program you will get the following output