Back
Close

PHP Test

michael-grunder
2,272 views

Redis->lRange()

Testing
<?php
function minOrMax(&$which, $a, $b) {
if (rand(1, 2) == 1) {
$which = "MAX";
return max($a, $b);
} else {
$max = "MIN";
return min($a, $b);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Redis->zRange()

Testing
<?php
function minOrMax(&$which, $a, $b) {
if (rand(1, 2) == 1) {
$which = "MAX";
return max($a, $b);
} else {
$max = "MIN";
return min($a, $b);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Redis->getBit()

Redis->getBit($str_key, $i_position): int
<?php
$obj_r = new Redis();
$obj_r->connect('127.0.0.1', 6379);
// 0111 1111
$obj_r->set('key', "\x7f");
/* Should print: 0 */
echo $obj_r->getBit('key', 0) . "\n";
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Redis->scan()

Redis->scan(&$it [, $str_pattern, $count]): array
<?php
$obj_r = new Redis();
$obj_r->connect('127.0.0.1', 6379);
/* Without enabling Redis::SCAN_RETRY (default condition) */
$it = NULL;
do {
// Scan for some keys
$arr_keys = $obj_r->scan($it);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants