3

validatedbname

validate_db_name
SYNOPSIS

validate_db_name($s)

DESCRIPTION

validate_db_name returns true if $s is a valid database name, false otherwise.

CODE
  1. function validate_db_name($s) {
  2.     $regexp='/^[a-zA-Z][a-zA-Z0-9_]{1,30}$/';
  3.  
  4.     return preg_match($regexp, $s);
  5. }

Comments

To add a comment, click here.