public function validOtp($otp) {
    $length  = strlen($otp);

    /* Check length. */
    if($length > 48 || $length < 32) {
      return false;
    }

    /* Check for printable charcters (no whitespace). */
    return ctype_graph($otp);
  }
public function validOtp($otp) {
    $length  = strlen($otp);

    /* Check length. */
    if($length > 48 || $length < 32) {
      return false;
    }

    /* Check for printable charcters (no whitespace). */
    return ctype_graph($otp);
  }
public function validOtp ( $ otp ) { $ length = strlen ( $ otp ) ; /* Check length. */ if ( $ length > 48 || $ length < 32 ) { return false ; } /* Check for printable charcters (no whitespace). */ return ctype_graph ( $ otp ) ; }
Validate a string as a one-time-password.
A valid OTP should consist of 32-48 printable characters.

@param string $otp
String to Validate

@return boolean
True if the OTP is valid, false on error.
Validate a string as a one - time - password . A valid OTP should consist of 32 - 48 printable characters .