I am not sure if this is a bug or not, but something is strange with this:
I run this little test script, this one is posted on php.net in comments
section


class MySimpleHeap extends SplMaxHeap
{
    public function  compare( $value1, $value2 ) {
        return ( $value1 - $value2 );
    }
}

$obj = new MySimpleHeap();
$obj->insert( 4 );
$obj->insert( 8 );
$obj->insert( 1 );
$obj->insert( 0 );

foreach( $obj as $number ) {
    echo $number."\n";
}

The output is 8 4 1 0
Good.
Now I change the 
class MySimpleHeap extends SplMaxHeap
to
class MySimpleHeap extends SplMinHeap

run it again (now I expet to get lowest value first) and get exact same
results back.

Is this a bug?



Dmitri Snytkine
Web Developer
Ultra Logistics, Inc.
Phone: (888) 220-4640 x 2097
Fax: (888) 795-6642
E-Mail: dsnytk...@ultralogistics.com
Web: www.ultralogistics.com

"A Top 100 Logistics I.T. Provider in 2011"




-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to