Javatpoint Logo
Javatpoint Logo

PHP Imagearc() Function

Imagearc( ) function is another inbuilt PHP function mainly used to draw an arc of a circle with a particular center and given coordinates. The function works using the x and y-axis, used to set coordinates for the starting point from where the picture has to be drawn. The origin coordinates (0, 0) are of the top left corner of the browsing window, and from the origin, we can set the coordinates to get the resulting arc according to our needs. The function returns Boolean values true on success and false on failure.

Syntax

Parameters

This function accepts these eight parameters.

S.No Parameter Description Optional / mandatory
1 $ image This parameter is used to define the size of the image we want to display. This parameter is used by an image resource like the imagecreatetruecolor( ) function used to return an image source. Mandatory
2 $ cx This parameter is used to set the desired arc's x-coordinates. Starting from the origin Mandatory
3 $ cd This parameter is used to set the desired arc's y-coordinates. Starting from the origin Mandatory
4 $ width This parameter is used to define the width of the arc that will be printed Mandatory
5 $ height This parameter is used to define the height of the arc that will be printed Mandatory
6 $ start This parameter is used to define the start angle of the arc in degrees that will be printed Mandatory
7 $ end This parameter is used to define the end angle of the arc in degrees that will be printed 0 is located at the three o'clock position, and the arc is drawn clockwise. Mandatory
8 $ color This parameter is used to define the color of the image. This parameter is used for creating a color identifies like the imagecolorallocate ( ) function optional

The imagearc( ) function returns TRUE on successful execution of the program and FALSE on a failed attempt.

Program 1: PHP program to display the basics of imagearc( ) function

Output

The above code gives the following output.

PHP Imagearc() Function

Here in this program, we have declared various variables like $image to define the size of the image that we require, $ image - color -1, and $ image - color - 2 to define the color of arc we require.

We have used the imagearc( ) function to declare the arc we want to display as an image. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser.

Program 2: PHP program to display the basics of imagearc( ) function

Output

PHP Imagearc() Function

Here in this program, we have declared various variables like $image to define the size of the image that we require, $ image - color -1, and $ image - color - 2 to define the color of arc we require. We have used the imagearc( ) function to declare the arc we want to display as an image. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser.

Program 3: PHP program to display the basics of imagearc( ) function

Output

PHP Imagearc() Function

Here in this program, we have declared various variables like $image to define the size of the image that we require, $ image - color -white, $ image - color - red, $ image - color - green, and $ image - color - blue to define the color of arc we require. We have used the imagearc( ) function to declare the arc we want to display and created a face using the image arc () function. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser.

Program 4: PHP program to display the basics of imagearc( ) function

Output:

PHP Imagearc() Function

Here in this program, we have declared various variables like $image to define the size of the image that we require, we have declared $background-color to assign a background color and $ image - color -white, $ image - color - red, $ image - color - green and $ image - color - blue to define the color of arc we require. We have used the imagearc( ) function to declare the arc we want to display and created a face using the image arc () function. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser.

Program5: PHP program to display the basics of imagearc( ) function

Output:

PHP Imagearc() Function

Here in this program, we have declared various variables like $image to define the size of the image that we require, we have declared $background-color to assign a background color and $ image - color -white, $ image - color - red, and $ image - color - black to define the color of arc we require. We have used the imagearc( ) function to declare the arc we want to display and created a face using the image are () function. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA