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

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

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

Disclosure: My content contains affiliate links.

43,236 questions

56,139 answers

573 users

How to use fmod() function to get the floating-point remainder (modulo) of the division x/y in PHP

1 Answer

0 votes
echo "fmod(4.3 . 2.0) = " . fmod (4.3 , 2.0) . "<br />";
echo "fmod(18.5 . 4.2) = " . fmod(18.5 , 4.3) . "<br />";
echo "fmod(5.1 . 3.0) = " . fmod(5.1 , 3.0) . "<br />";
echo "fmod(-5.1 . 3.0) = " . fmod(-5.1 , 3.0) . "<br />";
echo "fmod(5.1 . -3.0) = " . fmod(5.1 , -3.0) . "<br />";
echo "fmod(-5.1 . -3.0) = " . fmod(-5.1 , -3.0) . "<br />";
echo "fmod(0.0 . 1.0) = " . fmod(0 , 1.0) . "<br />";
echo "fmod(-0.0 . 1.0) = " . fmod(-0.0 , 1.0) . "<br />";
echo "fmod(3.1 . INF) = " . fmod(3.1 , INF) . "<br />";


/*
run: 

fmod(4.3 . 2.0) = 0.3
fmod(18.5 . 4.2) = 1.3
fmod(5.1 . 3.0) = 2.1
fmod(-5.1 . 3.0) = -2.1
fmod(5.1 . -3.0) = 2.1
fmod(-5.1 . -3.0) = -2.1
fmod(0.0 . 1.0) = 0
fmod(-0.0 . 1.0) = 0
fmod(3.1 . INF) = NAN

*/

 



answered Jun 18, 2016 by avibootz
...