Simple credit card number validation with PHP

I was looking for a quick and simple PHP function that would validating credit card numbers, but the code I found was mostly clunky and sometimes just wrong. I wrote this function and it seems to work correctly. Feel free to use it and leave a comment here if it works for you.

Here it is →   cc_validate.php