- substr: documentation ( source)
- var_dump: documentation ( source)
- strpos: documentation ( source)
- print_r: documentation ( source)
<?php
$string = "blah 2015 yar";
$pos = strpos($string, "20");
$year = substr($string, $pos, 4);
$end_year = "12/31/" . $year;
echo $end_year;
$end_time = new DateTime($end_year);
print_r($end_time);
$start_time = new DateTime();
print_r($start_time);
$date1 = $end_time->format('Y-m-d');
echo $date1;
$date2 = $start_time->format('Y-m-d');
$diff = $end_time->diff($start_time);
var_dump($diff);
?>