The process is called OCR (Optical Character Recognition).
You could take a look at phpOCR.
I've never tried it myself, but it's worth a shot.
By the way, I fiddled around with OCR in the past (using desktop apps, not PHP) and found that they're not flawless. For example they easily confuse a c for an o and vice versa. Overall the results are not bad, but it looks a bit like it's written by someone who's made some typos here and there