Skip to content

Instantly share code, notes, and snippets.

@ManojKiranA
Created October 9, 2019 13:54
Show Gist options
  • Save ManojKiranA/448e63024866660f9f8a50eed2faf663 to your computer and use it in GitHub Desktop.
Save ManojKiranA/448e63024866660f9f8a50eed2faf663 to your computer and use it in GitHub Desktop.
  function calculateForPercentage($actual,$total,$convertForPercentage = 100)
{
    return (($actual/$total)*$convertForPercentage);
}

Route::get('/test', function () {

$callback = function (){
    $days=0; 

    for($month=1;$month<=12;$month++){ 

        $days = $days + cal_days_in_month(CAL_GREGORIAN,$month,now()->format('Y'));
     }
 return $days;
};
dump((bool)now()->subYears(19)->format('L'));
dd(now()->endOfYear()->subYears(19)->format('z')+1);
dd(
    calculateForPercentage(25,50,100)
);

$calc = ($callback()*100)/now()->format('z');
dd($callback(),(int)now()->format('z'),$calc);
$currentDate = now()->format('z');
dd($currentDate);

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment