Skip to content
Advertisement

PHP date of birth checker

I am currently using the following PHP code to check date of birth, the code uses the american mm/dd/yyyy although I’m trying to change it to the british dd/mm/yyyy.

I was hoping someone could tell me what to change:

JavaScript

Advertisement

Answer

the explode is breaking up the string into an array, it is using the / as the separator.

So for us dates you would get

JavaScript

what you want is to swap the values at index 0 and 1.

try this:

JavaScript

Edit, added correction from comment: also change the last line to

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement