<?php
$id = '287080904421';
// Extract the "hidden" date part from the ID
$date = substr($id, 1, 6);
// Arbitrary decision
// if year < 70, then assume 21st century
// else assume 20th century
if (substr($date, 0, 1) < 7) {
$date = '20' . $date;
} else {
$date = '19' . $date;
}
$birthday = DateTime::createFromFormat('Ymd', $date);
echo $birthday->format('Y-m-d');
$now = new DateTime();
$diff = $now->diff($birthday);
var_dump($diff);
echo $diff->y
- Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
- Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /in/Q6H9R on line 20
Process exited with code 255.
preferences:
180.62 ms | 1395 KiB | 22 Q