PHP code example of timecop / scope-guard

1. Go to this page and download the library: Download timecop/scope-guard library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

timecop / scope-guard example snippets




public function test_foo()
{
    // Don't remove $t
    $t = new \TimeFreezeScopeGuard('2007-08-31 12:00:00');

    echo date('Y-m-d H:i:s');
    // 2007-08-31 12:00:00
}