Extracting values from a pattern of string is fairly simple in PHP. I use RegEx to do that often:
e.g. I am trying to extract the numerical value from this expression ” + 15 days “;
$lic_Expiry = " +15 days"; $pattern = "/\s*\+(.*)/"; if(preg_match($pattern, $lic_Expiry, $matches)) echo "$matches\n";
Note: If there are multiple elements that you would like to extract from the expression – use multiple round braces (Your-Regex) and the value will be passed on to the array $matches.