<?php class A { public $cache = [ 'a' => -1, 'b' => -1, 'c' => 0, ]; function sort () { uksort($this->cache, function ($a, $b) { return $this->cache[$a] <=> $this->cache[$b]; }); var_export($this->cache); } } $a = new A(); $a->sort(); $a->cache['d'] = -2; $a->sort();
You have javascript disabled. You will not be able to edit any code.