## zRangeByScore, zRevRangeByScore
##### *Description*
Returns the elements of the sorted set stored at the specified key which have scores in the range \[start,end\]. Adding a parenthesis before `<span class="calibre12">start</span>` or `<span class="calibre12">end</span>` excludes it from the range. +inf and -inf are also valid limits. zRevRangeByScore returns the same items in reverse order, when the `<span class="calibre12">start</span>` and `<span class="calibre12">end</span>` parameters are swapped.
返回key對應的有序集合中score介于min和max之間的所有元素(包哈score等于min或者max的元素)。元素按照score從低到高的順序排列。如果元素具有相同的score,那么會按照字典順序排列。
可選的選項LIMIT可以用來獲取一定范圍內的匹配元素。如果偏移值較大,有序集合需要在獲得將要返回的元素之前進行遍歷,因此會增加O(N)的時間復雜度。可選的選項WITHSCORES可以使得在返回元素的同時返回元素的score,該選項自從Redis 2.0版本后可用。
##### *Parameters*
*key*
*start*: string
*end*: string
*options*: array
Two options are available: `<span class="calibre12">withscores => TRUE</span>`, and `<span class="calibre12">limit => array($offset, $count)</span>`
##### *Return value*
*Array* containing the values in specified range.
##### *Example*
```
<pre class="calibre16">$redis->zAdd('key', 0, 'val0');
$redis->zAdd('key', 2, 'val2');
$redis->zAdd('key', 10, 'val10');
$redis->zRangeByScore('key', 0, 3); /* array('val0', 'val2') */
$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE); /* array('val0' => 0, 'val2' => 2) */
$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1)); /* array('val2' => 2) */
$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1)); /* array('val2') */
$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1)); /* array('val2' => 2) */
```
- php-redis中文幫助手冊
- 系統及通用函數
- construct
- connect,open
- pconnect, popen
- close
- setOption
- getOption
- ping
- echo
- randomKey
- select
- move
- rename, renameKey
- renameNx
- setTimeout,expire,pexpire
- expireAt,pexpireAt
- keys,getKeys
- dbSize
- auth
- bgrewriteaof
- slaveof
- object
- save
- bgsave
- lastSave
- type
- flushDB
- flushAll
- sort
- info
- resetStat
- ttl, pttl
- persist
- config
- eval
- evalSha
- script
- getLastError
- _prefix
- _unserialize
- dump
- restore
- migrate
- time
- String數據類型函數
- get
- set
- setex, psetex
- setnx
- del, delete
- getSet
- multi, exec, discard
- watch, unwatch
- subscribe
- publish
- exists
- incr, incrBy
- incrByFloat
- decr, decrBy
- mGet, getMultiple
- append
- getRange
- setRange
- strlen
- getBit
- setBit
- bitop
- bitcount
- mset, msetnx
- List數據類型相關函數
- lPush
- rPush
- lPushx
- rPushx
- lPop
- rPop
- blPop, brPop
- lSize
- lIndex, lGet
- lSet
- IRange,IGetRange
- lTrim,listTrim
- lRem,lRemove
- lInsert
- rpoplpush
- brpoplpush
- Set數據類型相關函數
- sAdd
- sRem, sRemove
- sMove
- sIsMember, sContains
- sCard, sSize
- sPop
- sRandMember
- sInter
- sInterStore
- sUnion
- sUnionStore
- sDiff
- sDiffStore
- sMembers, sGetMembers
- zSet數據類型相關函數
- zAdd
- zRange
- zDelete,zRem
- zRevRange
- zRangeByScore, zRevRangeByScore
- zCount
- zRemRangeByScore,zDeleteRangeByScore
- zRemByRank,zDeleteRangeByRank
- zSize,zCard
- zScore
- zRank,zRevRank
- zIncrBy
- zUnion
- zInter
- Hash數據類型相關函數
- hSet
- hSetNx
- hGet
- hLen
- hDel
- hKeys
- hVals
- hGetAll
- hExists
- hIncrBy
- hIncrByFloat
- hMset
- hMGet