#21922 [Opn->Bgs]: suggestion for a new function

From: Date: Tue, 28 Jan 2003 19:03:42 +0000
Subject: #21922 [Opn->Bgs]: suggestion for a new function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-31493@lists.php.net to get a copy of this message
ID: 21922 Updated by: pollita@php.net Reported By: no@email.com -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: all PHP Version: 4.2.3 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. No new function is needed for this as it can already been done with a single preg_replace call as shown by michael.mauch@gmx.de above. Previous Comments: ------------------------------------------------------------------------ [2003-01-28 12:59:22] michael.mauch@gmx.de 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"); ------------------------------------------------------------------------ [2003-01-28 09:14:01] no@email.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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21922&edit=1

« previous php.bugs (#31493) next »