GD support

How to check if GD support is enabled or not.

<?php
var_dump(gd_info());
?>

If GD support is enabled then you will get an array in that you will get “GD Version”.

If you didn’t get this that means GD support is not there .

To enable GD support you should install
GD library by the below command
“yum install php-gd” (Fedora Linux)
This will install GD support.

Now when you check the output of the above php code it will display the GD version

Calculate no of years,month,days,hours,minutes and seconds past since given date

function getYMDHMSPastFromTwoDate($startTimeStamp,$endTimeStamp)
{
$years = ”;
$Month = ”;
$Days = ”;
$Hrs = ”;
$Mins = ”;
$totalSecs = ”;
$timePastArr = array();
$date1 = $startTimeStamp;
$date2 = $endTimeStamp;
if($date1 > $date2)
{
$dateDiff = intval($date1 – $date2);
}
else
{
$dateDiff = intval($date2 – $date1);
}

$totalYears = $dateDiff/(365*24*60*60);
$years = floor($totalYears);
$timeRemaining = ($dateDiff – ($years*365*24*60*60));
$totalMonth = $timeRemaining/(30*24*60*60);
$Month = floor($totalMonth);
$timeRemaining = $timeRemaining – $Month*30*24*60*60;
$totalDays = $timeRemaining/(24*60*60);
$Days = floor($totalDays);
$timeRemaining = $timeRemaining-$Days*60*60*24;
$totalHrs = $timeRemaining/(60*60);
$Hrs = floor($totalHrs);
$timeRemaining = $timeRemaining-$Hrs*60*60;
$totalMins = $timeRemaining/60;
$Mins = floor($totalMins);
$timeRemaining = $timeRemaining-$Mins*60;
$totalSecs = floor($timeRemaining);

return $timePastArr = array(‘year’=>$years,’month’=>$Month,’days’=>$Days,’hours’=>$Hrs,’minutes’=>$Mins,’seconds’=>$totalSecs);

}