- preg_match: documentation ( source)
- var_export: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
- preg_replace: documentation ( source)
<?php
$text = 'On Monday Liam';
preg_match('/^(Today|Yesterday|On (last )?(Sun|Mon|Tues|Wed|Thurs|Fri|Satur)day )?(.*)/', $text, $matches);
$dow = $matches[1];
$dow = preg_replace('/^On /', '', $dow);
$date = strtotime('Last '.$dow);
$date = now();
print $dow;
print date("Y-m-d", $date);
var_export($matches);