From: Jason Woofenden Date: Thu, 21 Dec 2006 04:45:11 +0000 (-0500) Subject: added this_month() and this_year() X-Git-Url: https://jasonwoof.com/gitweb/?a=commitdiff_plain;h=ea730f77dfd663624009b6b0d916a690333d9652;p=wfpl.git added this_month() and this_year() --- diff --git a/basics.php b/basics.php index 72a33a3..4e1da44 100644 --- a/basics.php +++ b/basics.php @@ -5,9 +5,9 @@ function read_whole_file($name) { if($fd === false) { die("Failed to read file: '$name'"); } - $temp = fread($fd, filesize($name)); + $file_data = fread($fd, filesize($name)); fclose($fd); - return $temp; + return $file_data; } function unix_newlines($str) { @@ -15,5 +15,14 @@ function unix_newlines($str) { return str_replace("\r", "\n", $str); } +# return current year (all 4 digits) +function this_year() { + return strftime('%Y'); +} + +# return the number of the current month (1..12) +function this_month() { + return strftime('%m'); +} ?>