Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Brundage mattbrundage

View GitHub Profile
@mattbrundage
mattbrundage / assetQueryString.php
Created May 7, 2012
Determines the file modification date and whether or not to append a query string to the file path
View assetQueryString.php
function assetQueryString ($filePath, $maxAge = 7) {
$today = intval(strtotime(date("Y-m-d")) / 86400);
$fileDate = intval(strtotime(date("Y-m-d", filemtime($_SERVER['DOCUMENT_ROOT'].$filePath))) / 86400);
$days = $today - $fileDate;
if ($days <= $maxAge) {
$filePath .= "?".$fileDate;
}
echo $filePath;
}