lPop

PHP Redis

lPop

Description

Return and remove the first element of the list.

返回LIST顶部(左侧)的VALUE,并且从LIST中把该VALUE弹出。

Parameters

key

Return value

STRING if command executed successfully BOOL FALSE in case of failure (empty list)

取得VALUE成功,返回TURE。如果是一个空LIST则返回FLASE。

Example
$redis->rPush('key1', 'A');
$redis->rPush('key1', 'B');
$redis->rPush('key1', 'C'); /* key1 => [ 'A', 'B', 'C' ] */
$redis->lPop('key1'); /* key1 => [ 'B', 'C' ] */