A Photo Transistor is a sensor that detects ambient light, a bit like an LDR (and works in a similar way). We prefer these sensors as the package is a little more robust than your traditional LDRs.
When light enters the chip on top, it creates a flow of current from the long to the short pin. When there's no light there's almost no current going across the pins at all. It manages to detect light in a similar way to your own eyes, so it's great for projects that require human-level light monitoring!
To use these with your microcontroller, connect the long leg to 3-15V (DC) and the short leg via a 1-10k resistor to your GND pin, then code to read the analogue voltage via your analogue IN pin. Works great on the Raspberry Pi Pico - just switch it around if you don't get any readings!
Breadboard pictured but not included.