PHP | imagefilledarc() Function (original) (raw)

Last Updated : 11 Jul, 2025

The imagefilledarc() function is an inbuilt function in PHP which is used to draws a partial arc centered at the specified coordinate in the given image. This function return True on success or False on failureSyntax:

bool imagefilledarc ( image,image, image,cx, cy,cy, cy,width, height,height, height,start, end,end, end,color, $style )

Parameters: This function accepts nine parameters as mentioned above and described below:

Return Values: This function returns True on success or False on failure. Below programs illustrate the imagefilledarc() function in PHP:Program 1:

php `

bg=bg = bg=white = imagecolorallocate($img, 0xFF, 0xFF, 0xFF); green=imagecolorallocate(green = imagecolorallocate(green=imagecolorallocate(img, 0, 255, 0); // make pie arc. $center_x = (int)WIDTH/2; $center_y = (int)HEIGHT/2; imagerectangle($img, 0, 0, WIDTH-1, HEIGHT-1, $green); imagefilledarc($img, centerx,center_x, centerx,center_y, WIDTH/2, HEIGHT/2, 0, 220, $green, IMG_ARC_PIE); // Flush image. header("Content-Type: image/png"); imagepng($img); ?>

`

Output: Program 2:

php `

red=imagecolorallocate(red = imagecolorallocate(red=imagecolorallocate(image, 0xFF, 0x00, 0x00); darkred=imagecolorallocate(darkred = imagecolorallocate(darkred=imagecolorallocate(image, 0x90, 0x00, 0x00); // Make the 3D effect for ($i = 60; i>50;i > 50; i>50;i--) { imagefilledarc($image, 50, i,100,50,75,360,i, 100, 50, 75, 360, i,100,50,75,360,darkred, IMG_ARC_PIE); } imagefilledarc($image, 50, 50, 100, 50, 75, 360, $red, IMG_ARC_PIE); // flush image header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?>

`

Output: Reference: https://www.php.net/manual/en/function.imagefilledarc.php