I must have made a mistake somewhere with this one :(
The strings I am processing have this type of format:
" $7.00 now, then after 7 days $77.00 every 1 year"
" $4.99 now, then after 3 days $99.90 every 1 month"
"$7.00 now, then after 1 month $27.00 every 1 month"
The initial payment is easy enough but I am having problems
getting out the payment "gap_unit".
By "gap_unit", I mean the "after 7 days" or "after 1 month"
This is what I have:
Expand|Select|Wrap|Line Numbers
- // Find prices - gap unit
- if(preg_match('#([<=then after])(day)?(month)?#', $prod->price, $matches) == 1) {
- $price_gap_unit = $matches[0];
- if($price_gap_unit == '') $price_gap_unit = $matches[1];
- write_log("$prod->prod_id. Price_gap_unit: $price_gap_unit\r\n");
- }
- else {
- $price_gap_unit = 'none';
- }
95330. Price_gap_unit:So, it looks like the regex is finding the match, but it is not
in the $matches[0] or $matches[1] .
Any ideas what is going wrong ?