PHP: Formatting the day number suffix in php with date()
This worked for me:
echo date('M j\<\s\u\p\>S\<\/\s\u\p\> Y', $timestamp);
You just have to escape characters that are interpreted by the date function.
echo date('M j<\sup>S</\sup> Y'); // < PHP 5.2.2
echo date('M j<\s\up>S</\s\up> Y'); // >= PHP 5.2.2
At PHP date documentation you have a list with all characters replaced by their special meaning.