$string = 'a,b,c,d'; if(eregi("(a)|(c)|(adf)",$string,$matchedtext)){ echo $matchedtext[1]; // This returns an "a" which I want echo $matchedtext[2]; // This is empty, I want it to return a "c" }