title: Wind rose convert degree in cardinal point whit PHP
body: <p>I did a script to convert degrees in cardinal point in PHP this way:</p>
  
  <pre><code>&lt;?php
  $deg = 0;
  $cardinal = null;
  
  $deg = str_replace(',','.',$argv[1]);
  echo "Degree: ". $deg ."\t";
  
  if(($deg&gt;=0 &amp;&amp; $deg &lt;=  11.25) || ($deg &gt; 348.75 &amp;&amp; $deg &lt;= 360) ){ $cardinal = 'N';}
  elseif($deg &gt; 11.25  &amp;&amp; $deg &lt;=  33.75  ){ $cardinal = 'NNE';}
  elseif($deg &gt; 33.75  &amp;&amp; $deg &lt;=  56.25  ){ $cardinal = 'NE';}
  elseif($deg &gt; 56.25  &amp;&amp; $deg &lt;=  78.75  ){ $cardinal = 'ENE';}
  elseif($deg &gt; 78.75  &amp;&amp; $deg &lt;=  101.25 ){ $cardinal = 'E';}
  elseif($deg &gt; 101.25 &amp;&amp; $deg &lt;=  123.75 ){ $cardinal = 'ESE';}
  elseif($deg &gt; 123.75 &amp;&amp; $deg &lt;=  146.25 ){ $cardinal = 'SE';}
  elseif($deg &gt; 146.25 &amp;&amp; $deg &lt;=  168.75 ){ $cardinal = 'SSE';}
  elseif($deg &gt; 168.75 &amp;&amp; $deg &lt;=  191.25 ){ $cardinal = 'S';}
  elseif($deg &gt; 191.25 &amp;&amp; $deg &lt;=  213.75 ){ $cardinal = 'SSW';}
  elseif($deg &gt; 213.75 &amp;&amp; $deg &lt;=  236.25 ){ $cardinal = 'SW';}
  elseif($deg &gt; 236.25 &amp;&amp; $deg &lt;=  258.75 ){ $cardinal = 'WSW';}
  elseif($deg &gt; 258.75 &amp;&amp; $deg &lt;=  281.25 ){ $cardinal = 'W';}
  elseif($deg &gt; 281.25 &amp;&amp; $deg &lt;=  303.75 ){ $cardinal = 'WNW';}
  elseif($deg &gt; 303.75 &amp;&amp; $deg &lt;=  326.25 ){ $cardinal = 'NW';}
  elseif($deg &gt; 326.25 &amp;&amp; $deg &lt;=  348.75 ){ $cardinal = 'NNW';}
  else{ $cardinal = 'invalid';}
  
  echo "Cardinal point: ". $cardinal ."\n";
  </code></pre>
  
  <p>So I tried:</p>
  
  <pre><code>`for i in $(seq 0 0.01 360);do php windrose.php $i;done`
  </code></pre>
  
  <p>This produced wanted result:</p>
  
  <pre><code>Degree: 0.00    Cardinal point: N
  Degree: 0.01    Cardinal point: N
  Degree: 0.02    Cardinal point: N
  Degree: 0.03    Cardinal point: N
  ...
  Degree: 11.24   Cardinal point: N
  Degree: 11.25   Cardinal point: N
  Degree: 11.26   Cardinal point: NNE
  Degree: 11.27   Cardinal point: NNE
  Degree: 11.28   Cardinal point: NNE
  ...
  Degree: 33.74   Cardinal point: NNE
  Degree: 33.75   Cardinal point: NNE
  Degree: 33.76   Cardinal point: NE
  Degree: 33.77   Cardinal point: NE
  </code></pre>
  
  <p>So I thought: "It possible do this better?"
  There are a simplest way to do this?</p>