You can use preg_replace to remove all special characters from your string.
Example
echo $text= str_replace(' ','|', preg_replace('/[^A-Za-z0-9 ]/', '',"This is some $123 Money"));
Output
This|is|some|123|Money
More Related Contents:
- PHP DateTime supported formats
- Can I call a PHP function in a JavaScript click handler?
- Browser detection in PHP causes white screen [closed]
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE `id` [closed]
- Convert one date format into another in PHP
- Sort an Array by keys based on another Array?
- Converting string to Date and DateTime
- Blocking comment spam without using captcha [closed]
- Ignore html tags in preg_replace
- How to get JavaScript function data into a PHP variable
- How to enable curl in Wamp server [duplicate]
- Instantiate a class with or without parentheses? [duplicate]
- Symfony2 – creating own vendor bundle – project and git strategy
- fputcsv and newline codes
- How can I remove part of a string in PHP? [closed]
- Handling big user IDs returned by FQL in PHP
- How can I set cron job through PHP script
- Why shouldn’t I use PHP’s mail() function?
- Fatal error: Uncaught exception ‘mysqli_sql_exception’ with message ‘No index used in query/prepared statement’
- Find common values in multiple arrays with PHP
- Laravel nested relationships
- Laravel 5.2 not reading env file
- PHP – Check if the page run on Mobile or Desktop browser [duplicate]
- Dynamic Table Generation
- New containing div after every 3 records
- str_replace with array
- What is the JS equivalent to the PHP function number_format?
- How do I loop through JSON array
- Large hex values with PHP hexdec
- ZF2 – Get controller name into layout/views