FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Syntax for trim charlist?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Syntax for trim charlist? [message #171937 is a reply to message #171935] Sat, 22 January 2011 01:08 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On 21/01/11 23:35, GarryJones wrote:

> I need to trim away * and # in a list of names.

Assuming the list is a string or array, and that I have correctly
understood the requirement:

<?php
$destination = preg_replace("/[#*]+/g","",$source);
// $destination contains the modified version of $source
?>

or:

<?php
$source = preg_replace("/[#*]+/g","",$source);
// $source is replaced with filtered $source
?>

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Implement Php performace
Next Topic: Is there any situation where anything other than require_once is better?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 09:24:13 GMT 2024

Total time taken to generate the page: 0.05487 seconds