I have this code that simply validates a date, but ends the script if a error occurs (exit ()).
Now i want to put this same code in a single function that returns false on error.
I dont want to use “if/else”. I want to return false on error and stop execution of the others things.
Is that possible?
you could change
to
but exceptions would definitely be better as suggested by Ignacio Vazquez-Abrams