Discovered by Alexandre Edmond Becquerel in 1839, the photoelectric effect is the tendency for a material to emit electrons (electricity) when exposed to photons (most commonly visible light).
It is the photoelectric effect that makes solar panels work. Modern solar panels are doped semiconductors specially manufactured to efficiently generate electric current when exposed to visible light.
Solar panels consist of a great many individual solar cells wired together in series and parallel to produce useful power.
The electricity produced by a solar panel is direct current (DC) like that produced by a battery.
To be useful in a modern home or business the DC power produced by the solar panels must be converted into alternating current (AC).
Alternating current is used because it can easily and efficiently be transformed to a very high voltage which allows it to be transmitted long distances with minimal losses. The "magic box" that changes the DC from the solar panels to AC is called an inverter.