This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fh = fopen('php://stdin', 'r'); | |
$cmd = ''; | |
$bcLvl = 0; | |
while (true) | |
{ | |
$line = rtrim(fgets($fh)); | |
$bcLvl += substr_count($line, '{') - substr_count($line, '}'); | |
$cmd.= $line; | |
if ($bcLvl > 0 or substr($cmd, -1) !== ';') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Representation of a time interval, such as 1 year, | |
* or a more complex interval such as 1 month, 4 days and 6 hours. | |
* Provides methods for adding and substracting this interval | |
* to/from a given DateTime object or to/from a UNIX timestamp. | |
* Sample usage: | |
* $int = new TimeInterval(1, TimeInterval::YEAR); //1 year | |
* $int->addInterval(1, TimeInterval::MONTH); //allows creating more complex intervals (optional) | |
* $future = $int->addToDate(); //$future will be a DateTime object set to 1 year and 1 month from now |