Link to home
Start Free TrialLog in
Avatar of abangbatax
abangbatax

asked on

hi again

see this again :

person1only--
person1only,person2only--
person1only,person2only,person3only--
person1only,person2only,person3only,person4only--
person1only,person2only,person3only,person4only,person5only--
person1only,person2only,person3only,person4only,person5only,person6only--
person1only,person2only,person3only,person4only,person5only,person6only,person7only--

now what i want is

some how in my script i get number 2 and 4

how to replace person2only and person4only with "nothere" by the return number that i get from my script?

Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

I'm not sure if I understand this question.

You can use str_replace() to replace substrings. Your big string is stored in $result:

$new_result = str_replace(array('person2only','person4only'),'nothere',$result);

http://php.net/str_replace
Avatar of abangbatax
abangbatax

ASKER

$new_result = str_replace(array('person2only','person4only'),'nothere',$result);

i think you almost get what i mean

ok, like this

$return = "2,4";

$string = person1only,person2only,person3only,person4only,person5only,person6only,person7only--

i want the output to be :

$output = "person1only,nothere,person3only,nothere,person5only,person6only,person7only--";

how? :D
ASKER CERTIFIED SOLUTION
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
tested or not ...... i hope it worked
thank you! that exactly i want...