port to php from NREL's Solar Position Algorithm http://www.nrel.gov/midc/spa/
calculates precise position of the sun (compas heading and angle from the zenith) based on
1) your coordinates and elevation inputs
2) the datetime input
the output can be used to steer your solar pv panel positioning for example, or a shading system
keywords : solar position calculator
Relevant links :
https://www.esrl.noaa.gov/gmd/grad/solcalc/
http://rredc.nrel.gov/solar/codesandalgorithms/links.html
https://www.nrel.gov/rredc/solar_resource.html