The sleep was breaking it because a sleep on serverside causes the player to fall out of scope.
You can put the player object in a temporary variable first if you'd still like to do it on serverside (although in this case there's no reason to -- Jer's example should do exactly what you want it to).
PHP Code:
temp.pl = player; // put the player object in a temporary variable
sleep(2);
temp.pl.chat = "It still works!";