PHP string cleaner

TipoIT - author
Posted by : Darko Borojevic | contact me | go home

This example uses two regular expressions to strip the inserted string of all symbols, extra hyphens and extra white spaces so the end result is a clean text structure that contains lowercase words, and only one hyphen between each word. This has many use-case scenarios, for example, you can use it in a custom CMS for inserting clean SEO friendly blog titles, or url-s, based on the text that the author inserts in the input field.

Posted on: March 24, 2022

Print article Email article