Skip to content

Instantly share code, notes, and snippets.

@kornelski kornelski/search.php forked from antirez/search.php
Last active Aug 29, 2015

Embed
What would you like to do?
Codegolfed
<?
require("redis.php");
$term = $_GET['term'];
$r = new Redis("127.0.0.1","6379");
$r->connect();
$items = $r->zrangebylex("kernel", "[$term", "[$term\xff", ["LIMIT","0","10"]);
$t = [];
foreach($items as $id => $item) {
$t[] = ["id" => $id, "label" => $item];
}
echo json_encode($t);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.