Jump to content

Preg Replace Question


tserfer

Recommended Posts

Helllo guys

 

Lets say we have 2 strings that we want to replace . For example

 

1) rand(

2) mt_rand(

 

 

(I know that these 2 are functions but lets say that they are strings).

 

If i do:

 

$source = preg_replace( "/rand\(/","NEW");

 

it will Replace the mt_rand as well and it will become

mt_NEW(

 

How can i fix it so that it will replace the whole function and not a part of it?

We are talking about functions in strings

 

 

Hope you understand

Thanks

Link to comment
https://forums.phpfreaks.com/topic/283925-preg-replace-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.