note 109044 added to function.runkit-method-redefine
| From: | lauri dot piisang at cashongo dot co dot uk | Date: | Fri, 15 Jun 2012 14:07:19 +0000 |
| Subject: | note 109044 added to function.runkit-method-redefine | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188624@lists.php.net to get a copy of this message | ||
A sample implementation of redefining a public static method of symfony's sfDate to
'travel in time' with runkit:
<?php
//Going back in time 3 days
$subtractablePeriod = 3;
runkit_method_redefine('sfDateTimeToolkit', 'now', '', 'return
strtotime("-'.$subtractablePeriod.' days");', (RUNKIT_ACC_PUBLIC |
RUNKIT_ACC_STATIC));
//Do Stuff here that would otherwise get the current date
//Return to realtime
runkit_method_redefine('sfDateTimeToolkit', 'now', '', 'return
time();', (RUNKIT_ACC_PUBLIC | RUNKIT_ACC_STATIC));
?>
----
Server IP: 69.147.83.197
Probable Submitter: 84.50.247.162
----
Manual Page -- http://www.php.net/manual/en/function.runkit-method-redefine.php
Edit -- https://master.php.net/note/edit/109044
Del: integrated -- https://master.php.net/note/delete/109044/integrated
Del: useless -- https://master.php.net/note/delete/109044/useless
Del: bad code -- https://master.php.net/note/delete/109044/bad+code
Del: spam -- https://master.php.net/note/delete/109044/spam
Del: non-english -- https://master.php.net/note/delete/109044/non-english
Del: in docs -- https://master.php.net/note/delete/109044/in+docs
Del: other reasons-- https://master.php.net/note/delete/109044
Reject -- https://master.php.net/note/reject/109044
Search -- https://master.php.net/manage/user-notes.php