3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $curtime = '1810'; var_dump($curtime); $trading_hour['AT_open'] = '1715'; $trading_hour['AT_close'] = '2500'; $result = 'N'; if ($curtime <= '0100' || ($curtime >= '0830' && $curtime <= '2359')) { $isOverMidnight = false; $AT_close = $trading_hour['AT_close']; if ($AT_close > '2359') { $isOverMidnight = true; $AT_close = $AT_close - '2400'; $AT_close = sprintf('%04d', $AT_close); } if ($isOverMidnight) { if ($curtime <= $AT_close || ($curtime >= $trading_hour['AT_open'] && $curtime <= '2359')) { $result = 'AT1'; } } else { if ($curtime >= $trading_hour['AT_open'] && $curtime <= $AT_close) { $result = 'AT2'; } } echo $result; } else { echo 'stop'; }
Output for 5.2.6
string(4) "1810" AT1