Evidence::created_sort PHP Method

created_sort() public method

public created_sort ( $a, $b )
    public function created_sort($a, $b)
    {
        // This is used to sort arrays of Elements. In reverse.
        $a1 = strtotime($a->created);
        $b1 = strtotime($b->created);
        if ($a1 == $b1) {
            $a2 = $a->id;
            $b2 = $b->id;
            if ($a2 == $b2) {
                return 0;
            }
            return $a2 > $b2 ? +1 : -1;
        }
        return $a1 > $b1 ? +1 : -1;
    }