Forum Moderators: coopster

Message Too Old, No Replies

looping around a comma separated string

         

eatspinach

3:52 pm on Jul 9, 2009 (gmt 0)

10+ Year Member



hello

i have a cookie "$_COOKIE['questionList'];" which looks like this,

000, 822, 823, 824

I want to loop around this cookie and remove any occurrences of a certain number then reset the cookie again..

so for example $remove = 823

what is the best and most efficient way of doing this?

thanks

mooger35

4:31 pm on Jul 9, 2009 (gmt 0)

10+ Year Member



Personally, I would use explode [php.net], then check the array values and then implode [php.net] it back into the original format.

preg_replace [php.net] or str_replace [php.net] would also work.