如何在php中像5log(7.5 / 2)那样进行数学运算?

时间:2019-02-08 05:56:01

标签: php math

我试图像5 * log(7.5 / 2)那样做,但是我认为这是错误的方法,有人可以告诉我如何正确做吗?

1 个答案:

答案 0 :(得分:0)

在PHP中,使用log10而不是log来创建以10为底的对数(这是自然对数,即以 e 为底)。另请注意,注释中的比较示例是使用 select x.category ,count(x.roomId) - case when isnull(max(booked_rooms.cnt))=1 then 0 else max(booked_rooms.cnt) end as available_rooms from room x left join ( select c.category /* Find out the rooms bny category which are booked within the dates*/ ,count(c.roomID) as cnt from bookings a join reservedRoom b on a.bookingID=b.bookingID join room c on b.roomID=c.roomID where a.checkIndate between '2018-02-08' and '2018-02-09' group by c.category )booked_rooms on x.category=booked_rooms.category group by x.category ,而不是5.7。尝试以下方法:

7.5

输出:

echo 1+5*log10(5.7/2);

Demo on 3v4l.org