php - How to get change percentage value in laravel controller?

one text

Solution:

The formula for calculating the percentage change between two numbers is:

((V2 - V1) / V1) * 100

So what you most likely want is:

$userbalance = '2500';      
$changebalance = '2000';

$change = (($changebalance - $userbalance ) / $userbalance ) * 100;

Using the values in your example, the value of $change should be 20.

Source