PHP 7 Script to Reverse a Number Using strrev() Method Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments

 

Welcome folks today in this blog post we will be reversing a number using strrev() method using php 7. All the full source code of the application is shown below.

 

 

 

Get Started

 

 

 

In order to get started you need to make an index.php file and copy paste the following code

 

 

index.php

 

 

 

<?php

$number = 12345;
$reverse = 0;
while ($number != 0)
{
$reverse = $reverse * 10 + $number % 10;

$number = (int)($number / 10); 
}
 
echo $reverse;

?>

 

 

<?php

$number = 12345;

 
echo strrev($number);

?>

Leave a Reply