我正在研究需要将小数转换为十进制数的概率。因为我在查询中使用了“/”来查找概率。
获取概率的代码
<?php
$sql1=mysql_query("SELECT Deprication,
CONCAT(
SUM(CASE WHEN `number of room` = '$pane1' THEN 1 ELSE 0 END),
'/',
COUNT(Deprication)) AS `Probability of yes`
FROM expert
GROUP BY Deprication");
$col1=array();
while($u6=mysql_fetch_array($sql1))
{
echo "<tr>";
echo "<td></br>" . $u6['Deprication'] . "</td></br>";
echo "<td></br>" . $u6['Probability of yes'] . "</td></br>";
$col1[]=$u6['Probability of yes'];
}
现在我想将其转换1/5,1/4,1/2
为十进制。
输出
no 1/4
yes 2/6