How to get the coordinates of several points on the circle with php
<p>I have a few points. I need to put those points on a circle and get their coordinates.</p>

<pre><code>function positionX($numItems,$thisNum){ 
  $alpha = 360/$numItems; // angle between the elements
  $r = 1000; // radius
  $angle = $alpha * $thisNum; // angle for N element
  $x = $r * cos($angle); // X coordinates
  return $x;
}

function positionY($numItems,$thisNum){ 
  $alpha = 360/$numItems; // angle between the elements
  $r = 1000; // radius
  $angle = $alpha * $thisNum; // angle for N element
  $y = $r * sin($angle); // Y coordinates
  return $y;
}
</code></pre>

<p>But my code isn't work.. These functions produce strange coordinates.</p>

<p>image example: <a href="http://cl.ly/image/453E2w1Y0w0d" rel="nofollow">http://cl.ly/image/453E2w1Y0w0d</a></p>

<p><strong>UPD:</strong></p>

<pre><code>echo positionX(4,1)."&lt;br&gt;";
echo positionY(4,1)."&lt;br&gt;&lt;br&gt;";

echo positionX(4,2)."&lt;br&gt;";
echo positionY(4,2)."&lt;br&gt;&lt;br&gt;";

echo positionX(4,3)."&lt;br&gt;";
echo positionY(4,3)."&lt;br&gt;&lt;br&gt;";

echo positionX(4,4)."&lt;br&gt;";
echo positionY(4,4)."&lt;br&gt;&lt;br&gt;";
</code></pre>

<p>4 - All elements;
1,2,3,4 - Number of element.</p>

<p>These code gives me result:</p>

<pre><code>-448.073616129
893.996663601

-598.460069058
0

984.381950633
-176.045946471

-283.691091487
958.915723414
</code></pre>

<p>On the circle it does not work.</p>
