OK, I get a little suspicious when one function has multiple return formats, but I guess the point is that you want it to support the exact same list of operators in both contexts. (It doesn't actually support the same operators, but the goal is to do so.)

Personally, I'd lean toward doing a separate function ("createSQLFilterAsArray") since everything will be different, but if you do prefer one function... then we should update this function to report errors better -- e.g. all of those if() statements should say:

```php
if (!$returnSanitisedArray) {
  return sprintf(...);
} else {
  throw new Exception("Operator ($operator) not supported in this context");
  // note: we vetted $operator with in_array() test above
}
```

As an aside, it looks like the function's foreach() overstates what the filter can do -- it supports one filter criterion, not multiple.

```php
array('>' => 10) // OK
array('<' => 100) // OK
array('>' => 10, '<' => 100) // NOT OK; applies first filter but not second
```

Shouldn't we throw an exception in cases where there are multiple operators or where $operator is not in $acceptedSQLOperators?