How can you return elements between two values? I my be in a bit of a "wood for the trees" situation but how is it possible to return elements based on a custom field being between two supplied values.

For example returning users based on a number field. Let's say the number field is between 1 - 100 and I want to return users that have between 5 and 10 selected.

I could do it like the following

$users = craft()-&gt;elements-&gt;getCriteria(ElementType::User, array("customNumberField"=&gt;array(5,6,7,8,9,10))-&gt;find();


However that sets OR 

I know that you can use parameters eg "customNumberField"=&gt;"&lt;= 10" but obviously specifying that key twice causes it to be overwritten.

You can also specify an array with the parameters (avoiding the overwriting) like so

 $users = craft()-&gt;elements-&gt;getCriteria(ElementType::User, array("customNumberField"=&gt;array("&gt;= 5", "&lt;= 10"))-&gt;find();


But again this just creates customNumberField &gt;= 5 OR customNumberField &lt;= 10.

Is it possible to use the array as above but tell it to use AND instead of OR?

Am I on the right track or way off?
You’re close! You just need to begin the array with "and":

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::User);
$criteria-&gt;customNumberField = array('and', '&gt;=5', '&lt;=10');

$users = $criteria-&gt;find();


This same thing could also be accomplished from your templates like this:

{% set users = craft.users.customNumberField('and', '&gt;=5', '&lt;=10') %}