note 78587 added to function.date

From: Date: Thu, 18 Oct 2007 08:52:24 +0000
Subject: note 78587 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-131488@lists.php.net to get a copy of this message
Just a quick note on Josh L's implementation, switch doesn't pick up differences of '0' (or false) so if you are sending an email out at the same time as posting something, it will give you just a date (in the default) rather than a cute string. So, just add a catch at the top like <?php if($diff === 0) { return "just now"; } else { <do everything else> } ?> otherwise thanks josh for a v useful function :) ---- Server IP: 87.124.64.96 Probable Submitter: 148.197.60.140 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/78587 Del: integrated -- https://master.php.net/note/delete/78587/integrated Del: useless -- https://master.php.net/note/delete/78587/useless Del: bad code -- https://master.php.net/note/delete/78587/bad+code Del: spam -- https://master.php.net/note/delete/78587/spam Del: non-english -- https://master.php.net/note/delete/78587/non-english Del: in docs -- https://master.php.net/note/delete/78587/in+docs Del: other reasons-- https://master.php.net/note/delete/78587 Reject -- https://master.php.net/note/reject/78587 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131488) next »