Real quick... using PHP preg_match to try to match portions of a keyword. If said portion matches, I want to assign a value to a variable.
Unfortunately, EVERY SINGLE TIME the variable returns the first value.
Here's a sample of my code:
Someone please help. PHP.net and Google have failed me so far.
Unfortunately, EVERY SINGLE TIME the variable returns the first value.
Here's a sample of my code:
Code:
switch ($kw){
case preg_match("/\A-AB\z/",$kw):
$tag1 = "49";
break;
case preg_match("/\A-BC\z/",$kw):
$tag1 = "51";
break;
case preg_match("/\A-DE\z/",$kw):
$tag1 = "52";
break;
case preg_match("/\A-FG\z/",$kw):
$tag1 = "53";
break;
case preg_match("/\A-HI\z/",$kw):
$tag1 = "50";
break;
case preg_match("/\A-JK\z/",$kw):
$tag1 = "54";
break;
default:
$tag1 = "56";
break;
}
Someone please help. PHP.net and Google have failed me so far.