Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58064 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44663 invoked from network); 25 Feb 2012 13:21:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2012 13:21:44 -0000 Authentication-Results: pb1.pair.com header.from=dsnytkine@Ultralogistics.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dsnytkine@Ultralogistics.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain Ultralogistics.com from 64.197.110.172 cause and error) X-PHP-List-Original-Sender: dsnytkine@Ultralogistics.com X-Host-Fingerprint: 64.197.110.172 thrud.alliantinternet.com Received: from [64.197.110.172] ([64.197.110.172:34908] helo=thrud.alliantinternet.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/61-35434-660E84F4 for ; Sat, 25 Feb 2012 08:21:43 -0500 Received: by thrud.alliantinternet.com (Postfix, from userid 1001) id B6D9D174310; Sat, 25 Feb 2012 08:21:40 -0500 (EST) To: Date: Sat, 25 Feb 2012 08:21:39 -0500 Message-ID: <006601ccf3c0$68054cf0$380fe6d0$@alliantinternet.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Thread-Index: AczzwGZ47FciV8MNQva6ZE8cOif1fA== Content-Language: en-us x-cr-hashedpuzzle: AL4X AkAM AzZE BeGl BvDV CeXi CkV8 DKqi DcdN F0IN GE6O GPZ3 H1Nd JyZA J1SB LUpB;1;aQBuAHQAZQByAG4AYQBsAHMAQABsAGkAcwB0AHMALgBwAGgAcAAuAG4AZQB0AA==;Sosha1_v1;7;{71EC9FC8-00C3-4330-8E9B-B8DB6A578E95};ZABzAG4AeQB0AGsAaQBuAGUAQAB1AGwAdAByAGEAbABvAGcAaQBzAHQAaQBjAHMALgBjAG8AbQA=;Sat, 25 Feb 2012 13:21:36 GMT;SQBzACAAdABoAGkAcwAgAGMAbwByAHIAZQBjAHQAIABiAGUAaABhAHYAaQBvAHUAcgAgAHcAaQB0AGgAIABTAHAAbABNAGkAbgBIAGUAYQBwAD8A x-cr-puzzleid: {71EC9FC8-00C3-4330-8E9B-B8DB6A578E95} Subject: Is this correct behaviour with SplMinHeap? From: dsnytkine@Ultralogistics.com ("Dmitri Snytkine") 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: dsnytkine@ultralogistics.com Web: www.ultralogistics.com "A Top 100 Logistics I.T. Provider in 2011"