Dil*_*war 4 php datetime php-7
今天我遇到了一个同事在我写的应用程序中报告的 PhP-7 中的一个奇怪的错误/功能。归结为以下几点。
考虑以下:
echo date('Y-m-d', strtotime('first thu of Jan 2020'));
echo '<br/>';
echo date('Y-m-d', strtotime('first thu Jan 2020'));
echo '<br/>';
echo date('Y-m-d', strtotime('first wed of Jan 2020'));
echo '<br/>';
echo date('Y-m-d', strtotime('first wed Jan 2020'));
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我看到以下内容:
2020-01-02
2020-01-02
2020-01-01
2020-01-08
Run Code Online (Sandbox Code Playgroud)
奇怪的是,输出的第 3 行和第 4 行是不同的。为什么?of在这种情况下是错误还是必须使用?