logging - Php log and floor function strange behavior -


my problem following: log(1000,10) returns 3, floor(log(1000,10)) returns 2. how fix issue?

my phpversion 5.6.30-0+deb8u1.

from 13 year old comment @ php:log documentation:

$val = 1000000 $val2 = floor(log($val,10)) // gives value of 5 $val2 , not 6 expected. $val2 = floor(log10($val)) // gives correct value. 

so should use floor(log10(1000);

while i'm no expert, think different outcome in php5 , php7 (as pointed out in comments on question) has scalar type declaration, new feature in php 7 (try playing strict mode find out more, eg. https://3v4l.org/kvcol).


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -