Last active
January 21, 2023 13:25
-
-
Save nadimattari/7b95eb6b8b6335414872803ea6d0c791 to your computer and use it in GitHub Desktop.
Auqaat-us-salah
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Indian/Mauritius'); | |
$auqat['YEAR'] = implode(' | ', [ | |
'FAJR -18', | |
'SUNRISE ', | |
'DAHWAeKU', | |
'ZOHR ', | |
'MAGHRIB ', | |
'ESHA +18', | |
]); | |
$auqat['----'] = implode(' | ', [ | |
'--------', | |
'--------', | |
'--------', | |
'--------', | |
'--------', | |
'--------', | |
]); | |
$location = [ | |
'lat' => -20.054, | |
'lng' => 57.545, | |
]; | |
$date = date('m-d'); // today "mm-dd" | |
for ($y = 2022; $y <= 2047; $y++) { | |
$sun_info = date_sun_info( | |
strtotime("{$y}-{$date}"), | |
$location['lat'], | |
$location['lng'] | |
); | |
$sun_info['zawaal--zohr-starts'] = $sun_info['sunrise'] + ($sun_info['sunset'] - $sun_info['sunrise']) / 2; | |
$sun_info['dahwa-e-kubra'] = $sun_info['astronomical_twilight_begin'] + ($sun_info['sunset'] - $sun_info['astronomical_twilight_begin']) / 2; | |
foreach ($sun_info as $key => $val) { | |
$sun_info[$key] = date("H:i:s", (int)$val); | |
} | |
$auqat[$y] = implode(' | ', [ | |
$sun_info['astronomical_twilight_begin'], | |
$sun_info['sunrise'], | |
$sun_info['dahwa-e-kubra'], | |
$sun_info['zawaal--zohr-starts'], | |
$sun_info['sunset'], | |
$sun_info['astronomical_twilight_end'], | |
]); | |
} | |
echo json_encode([date('d-F') => $auqat], JSON_PRETTY_PRINT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample output