I need to verify that credit card numbers being entered are "valid" (not that they actually authorise, just fit all checksum requirements) using a PHP script.

Since I have no idea what algorithms are used to check numbers, has anybody seen some code that would do this floating about the web?

I really need it to work for UK debit cards (Switch, Solo, Delta) as well as the usual Mastercard/Visa but any links would be welcome

Thanks all