PHPでの時間の比較はstrtotimeを使うこと

if ('6:44:39' <= '10:44:40') echo "ok";

↑のプログラム、OKになると思いますか?
実はokになりませんので注意。
時間の比較はstrtotimeを使うこと。

if (strtotime('6:00:00') <= strtotime('10:00:00')) echo "ok";

以下検証

<?php
if ('6:00:00' <= '10:00:00') echo "ok\n"; // NG
if (strtotime('6:00:00') <= strtotime('10:00:00')) echo "ok\n"; // OK

echo " 6:00:00 = ". strtotime('6:00:00')."\n";
echo "06:00:00 = ". strtotime('06:00:00')."\n";
echo "10:00:00 = ". strtotime('10:00:00')."\n";

echo date('Ymd')."  6:00:00 = ". strtotime(date('Ymd'). ' 6:00:00')."\n";
echo date('Ymd')." 06:00:00 = ". strtotime(date('Ymd'). ' 06:00:00')."\n";
echo date('Ymd')." 10:00:00 = ". strtotime(date('Ymd'). ' 10:00:00')."\n";

結果

ok
 6:00:00 = 1366059600
06:00:00 = 1366059600
10:00:00 = 1366074000
20130416  6:00:00 = 1366059600
20130416 06:00:00 = 1366059600
20130416 10:00:00 = 1366074000

strtotimeで日付を省略すると実行日のタイムスタンプとなる。

ちなみに現在時刻と、ある時刻を比較したい場合は以下のようにする。

<?php
//22:30を超えているか?
if (strtotime(date('H:i:s')) > strtotime('22:30:00')) {
  echo "超えています";
}


低予算で始められるおすすめのFX口座はこちら。
http://s2fx.com/ranking/856.html