Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for($data as $key=>$value){
- print_r($value);
- }
- 'Hello. I have two dots. Please replace them!'
- 'Hello_ I have two dots_ Please replace them!'
- $text='Hello. I have two dots. Please replace them!';
- echo IHateStrReplace(".","_",$text);
- function IHateStrReplace($replace_from,$replace_to,$input)
- {
- $result="";
- for($i=0;$i<strlen($input);$i++)
- {
- $result.= ($input[$i]==$replace_from)?$replace_to:$input[$i];
- }
- return $result;
- }
- $var = 'Hello. I have two dots. Please replace them!';
- echo preg_replace('#.#', '_', $var);
- foreach($data as $key => $value){
- $data[$key] = preg_replace('/./', '_', $value);
- }
- print_r($data);
- $original_string = 'Hello. I have two dots. Please replace them!';
- $exploded_string = explode('.' , $original_string);
- $new_string = implode('_' , $exploded_string);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement