From:             
Operating system: Linux/CentOS
PHP version:      Irrelevant
Package:          *General Issues
Bug Type:         Feature/Change Request
Bug description:request for function similar to strpbrk but with replace 
features

Description:
------------
---
>From manual page: http://www.php.net/function.strpbrk
---

This is a great function I wasn't aware of until recently. I love that it
can 
find any character from a list of characters - very useful for filtering
data.

Would be even better if there were a similar function that replaced any
matched 
character listed in the input string with: 

1) a single specified character, 
2) a character from a list/string of characters (similar to what you do
with 
str_replace but without the need for arrays)
3) a random character from the supplied list of characters mentioned in
item 2.

#1 on that list is the most important of my request. #2 and 3 would be nice
to 
have but I can live without as str_replace already does some of this but 
requires arrays.

Test script:
---------------
Partial demo of concept

$char_list = "-!@#$%^&*()+=-/?.>,<;:"; //characters we want to remove
$input_string = "Some data that's not supposed to have $puncuation!";
$replace_string = '';
$result_string = strpbrk_replace($input_string, $char_list,
$replace_string);




Expected result:
----------------
And hopefully the result string looks like this:

"Some data that's not supposed to have puncuation"

Or if $replace_string had = ' ';
"Some data that's not supposed to have  puncuation "


Actual result:
--------------
See above...

-- 
Edit bug report at https://bugs.php.net/bug.php?id=60974&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=60974&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60974&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60974&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60974&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60974&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60974&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60974&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60974&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60974&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60974&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60974&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60974&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60974&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60974&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60974&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60974&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60974&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60974&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60974&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60974&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60974&r=mysqlcfg

Reply via email to