<h3>Description</h3><br />
<div class="code">Bf_Convert ( float windspeed, int format)</div><br />
This is a PHP function to convert a wind speed in knots to a beaufort scale. Takes a speed in knots and returns either the description (e.g. "Strong Breeze"), the beaufort number, or both.<br />
<br />
<h3>Parameter List</h3>
<br />
    <div class="code">speed</div><br />
<br />
the wind speed you want converted to Beaufort in Knots (nautical Miles per Hour)<br />
    <div class="code">format</div><br />
<br />
an integer which tells the function what sort of out put you want:<br />
<li>1 return the Beaufort Scale Force Number for the Wind Speed.<br />
<li>2 retrun the Beaufort Scale Name for the Wind Speed (e.g. "Strong Breeze")<br />
<li>3 return both, separtatd by a comma, (eg "5, Strong breeze")<br />
Return Values<br />
<br />
Returns either a number or a string of the Beaufort Scale eqivalent of the current wind speed.<br />
<br />
<h3>Example 1. Bf_convert() example</h3>
<div class="code">
  <p><br />
  &lt;?php</p>
  <p>echo Bf_convert(23.1,2);</p>
  <p>?&gt;</p>
</div>
<h3>The above will output:</h3>
<br />
<div class="code">Strong Breeze</div><br />
<br />
<h3>CODE:</h3>
<div class="code">function Bf_Convert ($speed, $return) {<br>
switch ($speed) {<br>
case ($speed &lt; 1):<br>
$bf=0; $desc = 'Calm';<br>
break;<br>
case ($speed &lt; 4):<br>
$bf=1; $desc = 'Light Air';<br>
break;<br>
case ($speed &lt; 7):<br>
$bf=2; $desc = 'Light Breeze';<br>
break;<br>
case ($speed &lt; 11):<br>
$bf=3; $desc = 'Gentle Breeze';<br>
break; <br>
case ($speed &lt; 17):<br>
$bf=4; $desc = 'Moderate Breeze';<br>
break;<br>
case ($speed &lt; 22):<br>
$bf=5; $desc = 'Fresh Breeze';<br>
break; <br>
case ($speed &lt; 28):<br>
$bf=6; $desc = 'Strong Breeze';<br>
break; <br>
case ($speed &lt; 34):<br>
$bf=7; $desc = 'Near Gale';<br>
break; <br>
case ($speed &lt; 41):<br>
$bf=8; $desc = 'Gale';<br>
break; <br>
case ($speed &lt; 48):<br>
$bf=9; $desc = 'Strong Gale';<br>
break;<br>
case ($speed &lt; 56):<br>
$bf=10; $desc = 'Storm';<br>
break; <br>
case ($speed &lt; 64):<br>
$bf=11; $desc = 'Severe Storm';<br>
break; <br>
case ($speed &gt; 64):<br>
$bf=12; $desc = 'Huricane';<br>
break; <br>
};<br>
//right decide what to output<br>
switch ($return) {<br>
case 1: $out = $bf;<br>
break;<br>
case 2: $out = $desc;<br>
break;<br>
case 3: $out = (&quot;$bf, $desc&quot;);<br>
break;<br>
}; <br>
return(&quot;$out&quot;);<br>
};</div>
