JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added this_month() and this_year()
authorJason Woofenden <jason183@herkamire.com>
Thu, 21 Dec 2006 04:45:11 +0000 (23:45 -0500)
committerJason Woofenden <jason183@herkamire.com>
Thu, 21 Dec 2006 04:45:11 +0000 (23:45 -0500)
basics.php

index 72a33a3..4e1da44 100644 (file)
@@ -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');
+}
 
 ?>