PHP: How to remove all non printable characters from string

2 minutes read

If you want to strip line feeds, carriage returns, and tabs you can use:


=>Note that you must use single quotes for the above two examples.

If you want to strip everything except basic printable ASCII characters (all the example characters above will be stripped) you can use:


Facebook Twitter LinkedIn Telegram Whatsapp

Related Posts:

How can I find non-ASCII characters in MySQL?   Query to find data as  “ASCII”, SELECT * FROM tableName WHERE NOT columnToCheck REGEXP '[A-Za-z0-9]'; 1 SELECT * FROM tableName WHERE NOT columnT...
What is PHP ? PHP stands for Hypertext Preprocessor and is a server-side language. PHP allows web developers to create dynamic content that interacts with databases. PHP is relatively new (compared to languages such as Perl (CGI) and Java) but is quickly becom...
How to manage international languages in MySQL database using php ? If you want to store multiple languages like Arabic, French, Hindi or Urdu to your MySQL database, default settings is not valid to do that to insert all languages in database. If you insert ...