Hello,
- $x = "tyu"
-
-
$y="3"
-
-
$eq = "asa+tyu-tyut+1"
-
-
$result = str_replace($x,$y,$eq);
-
-
echo $result;
$result has "asa+3-3t+1"
I expect "asa+3-tyut+1"
Please help .
That's pretty difficult to do, if not impossible unless you find some other pattern in your string.
use preg_replace()
http://us2.php.net/preg_replace
to implent some kind of pattern...
for example
does it always end with t, those that end with "t" do not replace?
does it have to end with "-" everytime?
should it end with any characters except a through z?
This will help you find a regex that can do what you want.
I'm no regex expert but I think if it comes down to that and you have all your constraints, we can build one, experiment and make it work together.
-Dan