imagepolygon() function in PHP

The imagepolygon() function is used to draw a polygon.

Syntax

bool imagepolygon( $img, $points, $num_points, $color)

Parameters

  • $img: Create a blank image with imagecreatetruecolor() function.
  • $points: An array with vertices of polygon.
  • $num_points: Total number of vertices in a polygon.
  • $color: A color identifier created with imagecolorallocate() function.

Return

The imagepolygon() function returns TRUE on success or FALSE on failure.

Example

The following is an example:

Output

The following is the output:

Updated on: 2019-12-31T07:17:56+05:30

412 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements