Hi,
I have a little question that I need a bit of advice on.
Say I have a variable (maybe $userlist) that contains something like
someone:1
someoneelse:4
differentperson:2
and so on... say i have a variable, $username = 'someone'
I need to search through this other variable and see if there is a line where 'someone' exists, and if it does, i need to increment the number right of the : by 1.
But, I need this to match someone and not someoneelse, obviously.
I'm thinking that preg_match would be the best choice for searching to see if it exists, but my regex is very poor.. Here is something I have:
preg_match("/\b".$username."\b/i",$userlist)
Is this enough to match correctly? or do I need to include the : and the number in the matching case.
I also could use a little help on how to preg_replace the new number value onto that line.
Any help or advice you could offer would be appreciated.
Thanks,
Jay