1. Go to this page and download the library: Download withinboredom/time 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/ */
function sleep(Time $time): void {
\sleep($time->as(Unit::Seconds));
}
// Helper functions are
// use the hour constant to get one hour
$hour = Hour;
$hour = $hour->multiply(10)->add(Minutes(10)); // get 10:10 hours
$interval = $hour->toDateInterval();
echo Hours(10) < $hour ? 'true' : 'false';
// output: true
class CacheItem {
public function __construct(
#[Field('expiration_in_seconds')]
#[TimeAs(Unit::Seconds)]
public Time $expiration,
) {}
}
$serde = new SerdeCommon(handlers: new \Withinboredom\Time\SerdeExporter());
$serde->serialize(new CacheItem(Minutes(5)), 'json');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.