SQL PHP HTML ASP JavaScript articles and free scripts to download
 

Modulus of two variables in PHP

We can get the modulus of two number by using math function modulus (%). This is same as reminder of a math division process of two number. Let us see this by the example script.


We can see the modulus of 160 and 15 is equal to 10. Same way the reminder or modulus is 0 if two numbers are 150 and 10.


$num1 = 160;
$num2 = 15;
echo "<P>The value of variable $num1 is $num1 & $num2 is $num2</P>";


$result = $num1 % $num2;
echo "<P>The modulus of these numbers is $result</P>";

PHP Math Functions
PHP Math Functions  |Addition Subtraction  |Maximum and Minimum numbers  |PHP Round  | Random number generator  | NUmber Formatting  | Ceil and floor value of a number  | Modulus or reminder

Discuss this tutorial at forum


 

Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
PHP Tutorials
Math Functions
PHP Sections
PHP Introduction
Loops & structure
Array
Date & Time
Functions
Form Handling
File Handling
Math Functions
String Functions
GD Functions
Comment Posting
Content Management
PHP & Ajax
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.