- Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
- string(6) "Monday" int(2)
<?php
$input = new \DateTime('2017-07-17');
$firstDayOfMonth = new \DateTime($input->format('Y-m-01'));
$order = (int)($input->format('n') / 7) + 1;
if ($input->format('N') > $firstDayOfMonth->format('N'))
$order++;
var_dump($input->format('l'));
var_dump($order);