- var_dump: documentation ( source)
- time: documentation ( source)
- microtime: documentation ( source)
- preg_match: documentation ( source)
- explode: documentation ( source)
- sprintf: documentation ( source)
<?php
$minAge = 86400; // 24h
list ($usec, $sec) = explode(' ', microtime(false));
$name = sprintf('%d%06d', $sec, $usec * 1000000);
var_dump($name, time());
$rows = array(
'import_1364895119900672_foobar',
'import_1364895119900672',
);
$drops = array();
$maxCreatedAt = true === $minAge
? time() - $minAge
: time() + 1;
foreach ($rows as $row) {
if (preg_match('/_([0-9]+)[0-9]{6}[_a-zA-Z]*$/', $row, $matches)) {
var_dump($matches[1]);
if ($maxCreatedAt > (int) $matches[1]) {
$drops[] = $row;
}
}
}
var_dump($drops);