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
------------- -  -- -   -

PHP General Mailing List (
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