Fairly simple PHP sorting Dilemma

Hey People,

I know this has got to be easy, but all I can find on “comparing custom objects” on google is comparing a custom object with ==

What I have is this simple class…

<?php

class PlayerData
{

    var $id;
    var $w_pct;
    
    function PlayerData($id)
    {
        $this->id = $id;
    }
    
    function set_id($id)
    {
        $this->id = $id;
    }
    
    function get_id()
    {
        return $this->id;
    }

    function set_w_pct($w_pct)
    {
        $this->w_pct = $w_pct;
    }
    
    function get_w_pct()
    {
        return $this->w_pct;
    }
}

?>

I am going to have an array of these objects and I want to be able to use a simple array sort, but I want the objects to be sorted by their w_pct (winning percentage). What is the easiest way to do this? I come from Java where I would simply implement comparable, but I am fairly new to PHP and quite sure it doesn’t exist…

Thanks!

–d