This is a discussion on Nybie question consering char replace within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, I'm trying to do a simple thing: to remove "(" -char from a string. I have tried ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I'm trying to do a simple thing: to remove "(" -char from a string. I have tried the following: echo $word . "<br>"; $changedWord = str_replace("(", "", $word); echo $changedWord . "<br>"; but $changedWord still has a "(" in it. $changedWord = ereg_replace("\(", "", $word); doesn't work neither. Thanks! |
|
|||
|
Esko Piirainen wrote:
> I'm trying to do a simple thing: to remove "(" -char from a string. > I have tried the following: > > echo $word . "<br>"; > $changedWord = str_replace("(", "", $word); > echo $changedWord . "<br>"; > > but $changedWord still has a "(" in it. > > $changedWord = ereg_replace("\(", "", $word); > doesn't work neither. > Are you sure that '(' is literal in $word and not as another representation like an entitity (e.g.: ()? When this is the case, you should do something like: $changedWord = str_replace(array("(", "("),"", $word); JW |