Improve: isValid($var) first argument is passed as reference