php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21922 suggestion for a new function
Submitted: 2003-01-28 09:14 UTC Modified: 2003-01-28 15:00 UTC
From: no at email dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.2.3 OS: all
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: no at email dot com
New email:
PHP Version: OS:

 

 [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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-28 12:59 UTC] michael dot mauch at gmx dot 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 13:03 UTC] pollita@php.net
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.



 [2003-01-28 13:20 UTC] no at email dot com
hi, it's already sorted,
my \t abs were at the start of the doc so trim() did the trick for me thanks,

thanks for the 'bogus' classification politta@php.net:

I'm not asking for help,
I'm trying to help,
I'm saying maybe there's a need for that function,
(same as with strip_tags etc)

you can do anything with regexp but that's not the issue,
it's weather there's an enough warrant/need/use for a new function

politta I don't care if you guys take it to heart or not,
but you shouldn't be someone with rights to classify suggestions if you can't read posts properly,

ok bye
 [2003-01-28 15:00 UTC] philip@php.net
Yet another example on how lame/overused/misleading the quickfix option _can_ be.

no@email, the text was autogenerated via a 'quickfix' option except the last paragraph.  I don't know why the quickfix was used here as it inserted irrelevant and bogus text.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC