From ea730f77dfd663624009b6b0d916a690333d9652 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Wed, 20 Dec 2006 23:45:11 -0500 Subject: [PATCH] added this_month() and this_year() --- basics.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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'); +} ?> -- 1.7.10.4