Skip to content

Instantly share code, notes, and snippets.

@postadelmaga
Created August 8, 2017 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save postadelmaga/005bb745358b4d91d9ddd71b63b5a285 to your computer and use it in GitHub Desktop.
Save postadelmaga/005bb745358b4d91d9ddd71b63b5a285 to your computer and use it in GitHub Desktop.
<?php
final class Present
{
protected $_is;
static protected $_now;
static protected $_time;
public function __construct()
{
self::$_now = $this;
return $this;
}
protected function _is()
{
return $this->_is;
}
public function getInstant()
{
if ($this->_is) {
$this->_is = false;
return time();
}
$this->_is = true;
$date = self::$_now->getInstant();
return $date;
}
}
$time = new Present();
echo $time->getInstant();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment