PHP match string, is fnmatch right for the job -
i'm trying figure out how can compare values array against particular string.
basically values chrisx001, chrisx002, chrisx003, chrisx004, bob001
i looking @ fnmatch() i'm not sure right choice, want keep chrisx--- ignore bob--- need wildcard last bit, there means of doing can
if($value == "chrisx%"){/*do something*/} and if thats possible possible double check % value int or similar in other cases?
regex can tell if string starts chrisx:
if (preg_match('/^chrisx/', $subject)) { // starts chrisx } you can capture bit after chrisx:
preg_match('/^chrisx(.*)/', $subject, $matches); echo $matches[1];
Comments
Post a Comment