Checkout www.php.net/strtr

-----Original Message-----
From: Philip Murray [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, July 18, 2001 1:31 AM
To: PHP General List
Subject: [PHP] Regular expressions

In Perl you can do this:

    $foo =~ tr/012/mpf/;

Which is the same as:

    $foo = str_replace("0", "m", $foo);
    $foo = str_replace("1", "p", $foo);
    $foo = str_replace("2", "f", $foo);

in PHP.

Is there a more elegant way of doing this in PHP? I tried preg_replace
but
it didn't seem to like my regexp.

Any ideas?

-------------------------------- -  -- -  -   -
Philip Murray
[EMAIL PROTECTED]
------------- -  -- -   -


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to