[ACCEPTED]-Simple PHP string replace?-php

Accepted answer
Score: 35

Have a look at str_replace

$abc = ' Hello "Guys" , Goodmorning';
$abc = str_replace('"', '$^', $abc);

0

Score: 8
str_replace('"','$^',$abc);

Should work for you.

0

Score: 4
$abc = ' Hello "Guys" , Goodmorning';

$new_string = str_replace("\"", '$^', $abc);
echo $new_string;

output:

Hello $^Guys$^ , Goodmorning

0

Score: 3
preg_replace('/"/', '$^', $abc);

0

Score: 1

Searching the manual would have brought you to this: http://php.net/manual/en/function.str-replace.php

str_replace('"', '$^', $abc);

0

Score: 1

You can use str_replace:

$abc = ' Hello "Guys" , Goodmorning';
echo str_replace('"','$^',$abc);

0

Score: 0

String replace function is used to replace 6 string. Your syntax is wrong. You have to 5 use php string function like below example. First of all, think 4 about first and two values and replace in 3 third. Let's have a look.

<?php
echo str_replace("Hello", "HI", "Hello Jack "); 
?>

It produces the 2 output.

HI Jack.

You can create an HTML form and 1 change on button only.

<form> 
input box 1 
input box 2 
input box 3 
button 

</form>

Another

 str_replace('"','$^',$var);

More Related questions