This is the tutorial for Percentage difference calculation in previous and currunt month in php.
<?php
date_default_timezone_set('UTC');
$currentMonth = date('n'); // n returns the numeric representation of the month (1-12)
$previousMonth = $currentMonth - 1;
if ($previousMonth === 0) {
$previousMonth = 12;
}
$currentValue = 100;
$previousValue = 90;
$difference = $currentValue - $previousValue;
$percentageDifference = ($difference / $previousValue) * 100;
echo "Current month: " . $currentMonth . "\n";
echo "Percentage difference from previous month: " . $percentageDifference . "%\n";
?>