X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=misc.php;h=2d90ada5852a931091447d747c645e04ab9b5f58;hb=38773f50c9e89f547d2e190d2ae64a5fc39a038d;hp=4e1da442c27d93f42a9305afda42430f66b529ce;hpb=33991182df707af9558bc761bf2f58d1f3f950ef;p=wfpl.git diff --git a/misc.php b/misc.php index 4e1da44..2d90ada 100644 --- a/misc.php +++ b/misc.php @@ -22,7 +22,32 @@ function this_year() { # return the number of the current month (1..12) function this_month() { - return strftime('%m'); + return ereg_replace('^0', '', strftime('%m')); +} + + +# php4 is broken, in that you cannot set a default value for a parameter that +# is passed by reference. So, this is set up to use the following screwy +# syntax: +# +# function foo($bar = 0) { +# if($bar !== 0) { +# $bar = $bar->ref; +# } +# ... +# } +# +# foo(); +# foo(ref($baz)); + +class stupid_reference { + var $ref; + function stupid_reference(&$ref) { + $this->ref = &$ref; + } +} +function ref(&$foo) { + return new stupid_reference($foo); } ?>