I have a couple of issues with this if statement which checks if a string ends with "address".
E.g this matches user_address
, user_address1
, user_address99
, etc. Which is correct.
The problem is that it also matches user_address_location
which is not correct.
I only want this to match if:
- Is ends with _address
- Also if it has a number on the end e.g _address2
/* Only establish an address field as ADDRESS if follows "user_address1" format */
if((stristr($column,"address") !== false)) {
$parts = explode("_", $column);
if (!empty($parts)) {
// address code
}
}