|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-01-28 09:14 UTC] no at email dot com
Hi, I was just in the #php irc channel and I asked 'how to strip all non-text characters from a string' and two minutes later another guy comes in and asks the same q', there is 'trim()' but it only does starts and ends, there is a function in unix that is called 'strings' that does approx this, can you look into it do you think, and if you do, maybe make it so it can be used the other way around too (strip all text), maybe call it 'strip_notext' or so thanks, Re PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 14:00:01 2025 UTC |
Have a look at the preg_replace function, which can do all kinds of this, e.g. try: echo preg_replace("/[[:alpha:]]/","","123hi456ho"); echo preg_replace("/[^[:alpha:]]/","","123hi456ho");