I would like to get the number of the week from a range of dates
for example if I have:
$fechaI = '2017-01-'01';
$fechaF = '2017-01-21';
then it's 3 weeks and I want to save it in a array
that is
$nSena =[1,2,3];
where 1,2,3
is the number of the week,
example two:
$fechaI = '2017-09-'01';
$fechaF = '2017-09-21';
then:
$nSena =[35,36,37,38];
I tried to do it but what I achieved was the following:
<?php
$fechaI = new DateTime('2017-09-01');
$fechaF = new DateTime('2017-09-21');
$interval = $fechaI->diff($fechaF);
echo floor(($interval->format('%a') / 7)) ;
and it returns me the number of weeks in that range that would be 4