Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Reverse a Number in PHP with Program

Hi, 

     Today, we will learn how to Reverse a Number in PHP.

First consider the number 1234. Here we need to get last number first. Hence i am using the modulus operator with divisor value  as 10  for getting the remainder value to move from last into first place.  Shall we go through the Program to reverse a number in PHP now?  

Program: Reverse a Number in PHP 


$m = 1234; $r=0;
for($i=0; $i
{
$r=$m%10;
echo $r;
$m = $m/10;
}
$m=$m%10;
echo $m;
?>

Output:

4321

The post Reverse a Number in PHP with Program appeared first on Payilagam | Java | .NET | Selenium| PHP | Android | DevOps| Ionic| Best Training in Chennai.



This post first appeared on Best .NET Training Institutes In Chennai, please read the originial post: here

Share the post

Reverse a Number in PHP with Program

×

Subscribe to Best .net Training Institutes In Chennai

Get updates delivered right to your inbox!

Thank you for your subscription

×