Now in doc there is:
... an object with the following indexes:
rise: moonrise time as DateTime
set: moonset time as DateTime
But, when i checked:
$moonTimes = $sc->getMoonTimes();
foreach ($moonTimes as $key => $val) {
echo $key.'</br>';
}
The result is:
moonrise
moonset
Which lead me to the usage:
$moonTimes = $sc->getMoonTimes();
$moonriseStr = $moonTimes['moonrise']->format('H:i');
$moonsetStr = $moonTimes['moonset']->format('H:i');
Otherwise i am getting an error.
So, concluding, the proper use case of getMoonTimes() is:
$sc = new SunCalc(new DateTime(), $lat(), $lon());
$moonTimes = $sc->getMoonTimes();
$moonriseStr = $moonTimes['moonrise']->format('H:i');
$moonsetStr = $moonTimes['moonset']->format('H:i');
Now in doc there is:
But, when i checked:
The result is:
Which lead me to the usage:
Otherwise i am getting an error.
So, concluding, the proper use case of getMoonTimes() is: