PHP (like w3) has a great way to answer all of your questions.
PHP: Hypertext Preprocessor
$today = getdate();
Why are you using getenv? It's used to return the value of a environment variable. I know enough PHP to get by, but it isn't one of my languages. Let me know.