Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
Last active October 29, 2020 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbvf50mobile/38e0538939fa46fc012ab83f4ed3ec94 to your computer and use it in GitHub Desktop.
Save lbvf50mobile/38e0538939fa46fc012ab83f4ed3ec94 to your computer and use it in GitHub Desktop.
Just PHP FUN 140.
<?php
# https://www.codewars.com/kata/5a58ca28e626c55ae000018a Calculate the area of a regular n sides polygon inside a circle of radius r.
function areaOfPolygonInsideCircle($circleRadius, $numberOfSides): float{
$r = $circleRadius * $circleRadius;
$sin = sin(deg2rad(360/$numberOfSides));
return round($r * $numberOfSides * $sin / 2,3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment