3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php print_r($datetime = DateTime::createFromFormat('Ymd', date("Ymd"))); echo $daynum = date("w", strtotime($datetime->format('D')));
based on ErgQn
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.21.3, 7.0.0 - 7.3.0rc3
DateTime Object ( [date] => 2018-01-26 01:59:22.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 5
Output for hhvm-3.22.0
DateTime Object ( [date] => 2018-01-26 01:59:23.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) 5