Для получения полного доступа
зарегистрируйтесь.
RSS

All snippets tagged with "keys" tag



dignityinside
  • Reputation: 26
  • Snippets: 21
  • Revisions: 1

Function to sort an array according to its keys which are floats casted as strings.

function sort_string_float($a, $b) {

	$a = (float) $a;
	$b = (float) $b;

	if ($a == $b) {
		return 0;
	}

	return $a < $b ? -1 : 1;

}

// use
uksort($l1_data, 'self::sort_string_float');
dignityinside
  • Reputation: 26
  • Snippets: 21
  • Revisions: 1

Small bash script to delete redis cache.

 redis-cli KEYS "username*" | while read key; do redis-cli DEL $key; echo $key; done