Martijn van Hoof
Martijn van Hoof

Reputation: 760

PHP function for calculating step_size

I am looking for a PHP function to get the "step_size".

Example:

0.00001000 = 5
0.00000100 = 6
0.00010000 = 4

Thanks for your time :)

Martijn

Upvotes: 0

Views: 65

Answers (2)

VIPLIKE
VIPLIKE

Reputation: 306

Martijn!

You can use basic log function:

// 5
echo log(0.00001000, 0.1);

// 6
echo log(0.00000100, 0.1);

// 4
echo log(0.00010000, 0.1);

Upvotes: 1

KIKO Software
KIKO Software

Reputation: 16771

This looks like a log10() function. This code:

echo log10(1.0 / 0.00001000);
echo log10(1.0 / 0.00000100);
echo log10(1.0 / 0.00010000);

Will return 564.

Then again this might totally not be what you want.

Upvotes: 1

Related Questions