The imagearc() function is an inbuilt function in PHP which is used to create an arc of a circle centered at the given coordinates. This function returns true on success or false on failure.
bool imagearc( $image, $cx, $cy, $width, $height, $start, $end, $color )
Parameters: This function accepts eight parameters as mentioned above and described below:
- $image: It is returned by one of the image creation functions, such as imagecreatetruecolor(). It is used to create size of image.
- $cx: It is used to set x-coordinate of the center.
- $cy: It is used to set y-coordinate of the center.
- $width: The width of arc.
- $height: The height of arc.
- $start: It is used to set the arc start angle, in degrees.
- $end: It is used to set the arc end angle, in degrees. 0° is located at the three-o’clock position, and the arc is drawn clockwise.
- $color: It sets the color of image. A color identifier created by imagecolorallocate() function.
Return Value: This function returns true on success or false on failure.
Below programs illustrate the imagearc() function in PHP.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.