Hi I was wondering what the best practise for checking user input would be.
I have the code:
$currencyConverter = new CurrencyConverter( $_GET['from'], $_GET['to'], $_GET['amnt'] );
Would it be best to check the user inputs are valid before sending to the class or should I just write a check in the methods constructor?
Cheers
I would always stick to validating user input early, for one simple fact:
Follow that rule, and pass back sanitized input to your models & views.