There are several ways to sanitize user input in PHP, depending on the type of data and how you plan to use it.
Here is an example of a basic XSS filtering function in PHP: