SQL PHP HTML ASP JavaScript articles and free scripts to download If you are facing any problem in viewing this page, please tell us
 

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>";




Sections
PHP
JavaScript
ASP
HTML
SQL
Photoshop
Articles SEO
PHP Tutorials
Math Functions
PHP Monthly Planner
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.