Hi,

To sort some database info I decided to use a class and fill an array ($cats) with this.

class Category {
    var $name;

var $nameArray = array();
var $feesArray = array();
var $is_automaticArray = array();
var $paddingArray = array();

function Category($name)
{
    $this->name = $name;
}

/* This is the static comparing function: */
static function cmp_obj($a, $b)
{
    $al = strtolower($a->name);
    $bl = strtolower($b->name);
    if ($al == $bl) {
        return 0;
    }
    return ($al > $bl) ? +1 : -1;
}
}

usort($cats, array("Category", "cmp_obj"));

All works fine on my local system but on the server I get a blank page, no error messages. I belief the problem is in the code in:

static function cmp_obj($a, $b)

When I remove this function the page loads correctly but obviously it shows the error message: usort(): Invalid comparison function

Anyone knows what could be the problem on the server side?

Thanks!

    All works fine on my local system but on the server I get a blank page

    This normally means your server isn't running the latest version of PHP.

    Make sure you are version 5+

      Thanks BuzzPHP, so this is indeed a version issue? I did check the PHP version on this particular server and it is 4.x

        Write a Reply...