write better looking and less verbose code
<p>Ive got the following snippet of code, which works and does what I need it to do. The only problem is I think its a little 'verbose' and can do with some optimising. Can someone help me  reduce the repetitiveness if at all possible. Most of the code is very similar...</p>

<p>Many thanks</p>

<pre><code>&lt;?php 

// condition = Less Than; More Than; Between
// noofweeks = this is the number of weeks chosen by the user

function fmsSupplements($condition, $conditionWeeks, $noofweeks, $weekno, $weekStartno,      $weekEndno, $basicprice, $supplementAmnt, $supplementType) {

if ($condition== "Between") {
// I need to get the start and end values as the data in this parameter should look like 1-17 
$betweenArray = explode('-',$conditionWeeks);
$startWeek = $betweenArray[0];
$endWeek = $betweenArray[1];
}


if(($condition == "Less Than") &amp;&amp; ($noofweeks &lt; $conditionWeeks) &amp;&amp; ($supplementType ==    'Subtract') &amp;&amp; ($weekno &gt;= $weekStartno &amp;&amp; $weekno &lt;= $weekEndno) )  { return $basicprice -  $supplementAmnt; }

elseif(($condition == "Less Than") &amp;&amp; ($noofweeks &lt; $conditionWeeks) &amp;&amp; ($supplementType == 'Add') &amp;&amp; ($weekno &gt;= $weekStartno &amp;&amp; $weekno &lt;= $weekEndno) )  { return $basicprice + $supplementAmnt; }

elseif(($condition == "More Than") &amp;&amp; ($noofweeks &gt; $conditionWeeks) &amp;&amp; ($supplementType == 'Subtract') &amp;&amp; ($weekno &gt;= $weekStartno &amp;&amp; $weekno &lt;= $weekEndno) )  { return $basicprice - $supplementAmnt; }

elseif(($condition == "More Than") &amp;&amp; ($noofweeks &gt; $conditionWeeks) &amp;&amp; ($supplementType == 'Add') &amp;&amp; ($weekno &gt;= $weekStartno &amp;&amp; $weekno &lt;= $weekEndno) )  { return $basicprice + $supplementAmnt; }    

elseif(($condition == "Between") &amp;&amp; ($noofweeks &gt;= $startWeek &amp;&amp; $noofweeks &lt;= $endWeek) &amp;&amp; ($supplementType == 'Add') &amp;&amp; ($weekno &gt;= $weekStartno &amp;&amp; $weekno &lt;= $weekEndno) )  { return $basicprice + $supplementAmnt; }

elseif(($condition == "Between") &amp;&amp; ($noofweeks &gt;= $startWeek &amp;&amp; $noofweeks &lt;= $endWeek) &amp;&amp; ($supplementType == 'Substract') &amp;&amp; ($weekno &gt;= $weekStartno &amp;&amp; $weekno &lt;= $weekEndno) )  { return $basicprice - $supplementAmnt; }   

//if no conditions match, just return the unaltered basic price back

else { return $basicprice ;}

;} ?&gt;
</code></pre>
