468,256 Members | 1,458 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,256 developers. It's quick & easy.

How to substitute a character for another one

Hi.

I want to substitute a character (e.g. 'R') for another one ('-R')
within a
word: 'RECORD' ---> '-RECO-RD'

Is it possible by using any PHP command? Regards.

Jul 17 '05 #1
1 4962
<?

$i = "record";

$x = str_replace("r", "-r", $i); // looks through i for r's, replaces
them with -r's

echo $x;

?>

that should work.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Alex | last post: by
5 posts views Thread by Gary McCullough | last post: by
14 posts views Thread by Glen Able | last post: by
17 posts views Thread by =?Utf-8?B?R2Vvcmdl?= | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.