Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,907 questions

51,839 answers

573 users

How to calculate log10 (base-10 logarithm) in PHP

3 Answers

0 votes
/*
float log10 ( float $arg )
*/

echo log10(123) . "<br />";
echo log10(1234) . "<br />";
echo log10(12345) . "<br />";
    
/*
run:

2.0899051114394
3.0913151596972
4.091491094268

*/

 



answered Dec 13, 2015 by avibootz
0 votes
/*
float log10 ( float $arg )
*/

echo number_format(log10(123), 2) . "<br />";
echo number_format(log10(1234), 2) . "<br />";
echo number_format(log10(1235), 2) . "<br />";
    
/*
run:

2.09
3.09
3.09

*/

 



answered Dec 13, 2015 by avibootz
0 votes
/*
float log10 ( float $arg )
*/

echo intval(log10(123)) . "<br />";
echo intval(log10(1234)) . "<br />";
echo intval(log10(12345)) . "<br />";
    
/*
run:

2
3
4

*/

 



answered Dec 13, 2015 by avibootz

Related questions

2 answers 314 views
1 answer 275 views
1 answer 165 views
165 views asked Feb 8, 2020 by avibootz
...