String Search and Replace

Here’s the situation:

for($i=1; $i<5; $i++) { reset($VolForm_WorkChoices); $HData .= "n" . (string)$i . ':'; while( $element = each( $VolForm_WorkChoices ) ) {if ( $element[ 'value' ] == $i ) {$HData .= "n<P class='indentedtext'>" . $element[ 'key' ] . "</P>";} } }
This works but for the fact that $element[‘key’] contains characters that I don’t want in the final output. In other words I need to replace all occurances of a specific character with another.

I figure someone must have done this a couple of thousand times before. Would anyone like to send me an example of it?


have you tried str_replace()?

Thanks. I just discovered it and came back here to say “Don’t waste your time on this one.”

Thanks again, and next time I’ll check the manual first!

Sponsor our Newsletter | Privacy Policy | Terms of Service