$tableName = "users"; if(isTableOrIdentifier($tableName)){ echo "Valid table name"; } else { echo "Invalid table name"; } Output: Valid table name
$columnName = "first_name"; if(isTableOrIdentifier($columnName)){ echo "Valid column name"; } else { echo "Invalid column name"; } Output: Valid column nameThis function is not part of any PHP package library, it is a custom function that can be added to a PHP script.