Debugging month-dependent PHP scripts

A bit new to php, yet I have a PHP script that basically checks what month are we in, and according to that it perofrms a certain action.

Now, is there a way to make the php environment "think" that we are in a different month, so I could test out the reaction over the 12 month without actually waiting for a year to pass, lol.

Answers


function getMonth(){
return 3;
}

function getMonth(){
return date('n');

}

Use a function, use the 2nd one in your real code, and the first one when you are testing.

You could get jiggy with it and include it in a file, just comment out one or the other as needed.


Need Your Help

How to run python script once in a day that is creating back-up copy of network dir?

python copy save backup

I want to take back-up copy of my network dirs once in a day on specified time, Below is the code of my current work by which i am running it manually.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.