note 109019 added to function.time

From: Date: Wed, 13 Jun 2012 08:25:14 +0000
Subject: note 109019 added to function.time
Groups: php.notes 
Request: Send a blank email to php-notes+get-188552@lists.php.net to get a copy of this message
hebrew time Ago function by xzxxx7 <?php function he_timeAgo( $a ){ $b = time() - $a; $c = array( 12 * 30 * 24 * 60 * 60, 30 * 24 * 60 * 60, 7 * 24 * 60 * 60, 24 * 60 * 60, 60 * 60, 60 ); $d = array( "שנה", "חודש", "שבוע", "יום", "שעה", "דקה" ); $e = array( "שנים", "חודשים", "שבועות", "ימים", "שעות", "דקות" ); if( $b < 60 ) return "פחות מדקה"; for( $f=0; ( $h = $b/$c[$f] ) <= 1 && $f < 5; $f++); return ( floor($h) > 1 ) ? sprintf( "%d %s", $h, $e[$f] ) : $d[$f]; } ?> <!doctype html> <html lang="he_IL" dir="rtl"> <head> <title>[PHP] he_timeAgo function</title> <meta charset="utf-8"> <meta name="author" content="xzxxx7"> </head> <body> פורסם לפני <?php echo he_timeAgo(1111111111);?> </body> </html> ---- Server IP: 69.147.83.197 Probable Submitter: 46.117.21.137 ---- Manual Page -- http://www.php.net/manual/en/function.time.php Edit -- https://master.php.net/note/edit/109019 Del: integrated -- https://master.php.net/note/delete/109019/integrated Del: useless -- https://master.php.net/note/delete/109019/useless Del: bad code -- https://master.php.net/note/delete/109019/bad+code Del: spam -- https://master.php.net/note/delete/109019/spam Del: non-english -- https://master.php.net/note/delete/109019/non-english Del: in docs -- https://master.php.net/note/delete/109019/in+docs Del: other reasons-- https://master.php.net/note/delete/109019 Reject -- https://master.php.net/note/reject/109019 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188552) next »