Jump to content

Basic math functions


emorr1981

Recommended Posts

$add = 2 + 2;

echo $add; // prints 4

 

$sub = 5 - 2;

echo $sub; //prints 3

 

$mul = 3 * 2;

echo $mul; // prints 6

 

$div = 4 / 2;

echo $div; //prints 2

 

$mod = 2 % 1;

echo $mod; // prints 0

 

...hope this helps, you can find a LOT more online if you search for "php math functions"

Link to comment
https://forums.phpfreaks.com/topic/42231-basic-math-functions/#findComment-204870
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.