assuming we have this regex:
preg_match('/\b(xbox|xbox360|360|pc|ps3|wii)\b/i' , $string, $matches);
now, whenever the regex match for ex. one of the three xbox methods (xbox|xbox360|360), the $matches
, should return just XBOX
is this possible continuing to work in the preg_match()
context or i should use some other method?
thank's in advance.
EDITED:
im actually doing it like this:
$x = array('xbox360','xbox','360');
if( preg_match('/\b(xbox360|xbox|360|pc|ps3)\b/i', $s, $m ) ) {
$t = $m[0];
}
if ( in_array($t,$x) ) {
$t = 'XBOX';
}
i'm wondering if there is another way!