I think this is not possible, but thought I would ask. Say I have 2 functions, function A call function B. Function B gives current time. E.g.
function A () {return b (); } Function B () {return time (); }
Also say that I really want to return a different time. (Say when the date is '2014-09-01'), but I do not want to change the function B. (That's why I can not use the straight-line in function B, or in some function I can pass in B and it can return ... I'm stuck with B). Is there a way to change the time in function A, so that the function gives the specified time in the B function? E.g.
function A () {set_default_time_to ('2014-09-01'); Return b (); // Returns equal to striatime ('2014-09-01')}} function B () {return time ();
Edit : I have been asked to clarify.
So I think I work more, so it's a simple statement without 2 functions. ..I want something that will do something like the following
function a () {echo time (); // echos current time set_default_time_to ('2014-09-01'); Echo time (); // Returns equal to striatime ('2014-09-01')}
The reason I split it into 2 functions because I want to emphasize that I just change Can not do the time () for strtotime, mktime, or any other function, the second function does extra stuff, but for simplicity sake it has been removed.
function A () {echo B (); // echos current time set_default_time_to ('2014-09-01'); Echo (b); // Returns equal to striatime ('2014-09-01')}} function b () {$ time = time (); // Some logic stuff return here; }
I can not change B, this is what it is.
I also know that we can use PHP scripts to open script, but I would prefer a method that does not support the use of PHP scripting.
Comments
Post a Comment