PHP没有给我一个数字类型

I tried to follow the instructions in this question: STAR rating with css but I've just a big problem.

When I do:

<span class="stars">1.75</span>

or

$foo='1.75';
echo '<span class="stars">'.$foo.'</span>

the stars is correctly shown, but as soon as I do:

while($val = mysql_fetch_array($result)) 
{  
$average =  ($val['services'] + $val['serviceCli']  + $val['interface'] + $val['qualite'] + $val['rapport'] )  / 5 ;

<span class="stars">.$average.</span>
}

the stars stops working

I double checked the data type in mysql:
they're all TINYINT(2)

and I tried this:

$average = intval($average);

but it's still not working,

I think your problem may be that the value you have is greater than the 5 allowed in that example.

What you want to do is weight the items such that the total for $average is less than or equal to 5.

$average = (
    ( $val['services'] / $maxServices )
    + ( $val['serviceCli'] / $maxServiceCli )
    + ( $val['interface'] / $maxInterface )
    + ( $val['qualite'] / $maxQualite )
    + ( $val['rapport'] / $maxRapport )
);

The weighting could be even, so each of the values will be less than or equal to 1, or they could have different weights so services is worth more than qualite (and so on).

no, var_dump($val) gives me ALL the value i get from my big request (text, varchar, int) [example :

array(38) { [0]=>  string(28) "http://www.crystal-serv.com/" 
["siteweb"]=>  string(28) "http://www.crystal-serv.com/" 
[1]=>  string(1) "0" ["offreDedie"]=>  string(100) 
"tick rouge" [2]=>  string(1) "0" ["coupon"]=> 

..........