Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- SPL: SplHeap with overridden compare() --FILE-- <?php class SplMinHeap2 extends S..

Decoded Output download

--TEST--
SPL: SplHeap with overridden compare()
--FILE--
<?php
class SplMinHeap2 extends SplMinHeap {
    public function compare($a, $b): int {
        return -parent::compare($a,$b);
    }
}
$h = new SplMinHeap2();
$h->insert(1);
$h->insert(6);
$h->insert(5);
$h->insert(2);
var_dump($h->top());

class SplMaxHeap2 extends SplMaxHeap {
    public function compare($a, $b): int {
        return -parent::compare($a,$b);
    }
}
$h = new SplMaxHeap2();
$h->insert(1);
$h->insert(6);
$h->insert(5);
$h->insert(2);
var_dump($h->top());
?>
--EXPECT--
int(6)
int(1)

Did this file decode correctly?

Original Code

--TEST--
SPL: SplHeap with overridden compare()
--FILE--
<?php
class SplMinHeap2 extends SplMinHeap {
    public function compare($a, $b): int {
        return -parent::compare($a,$b);
    }
}
$h = new SplMinHeap2();
$h->insert(1);
$h->insert(6);
$h->insert(5);
$h->insert(2);
var_dump($h->top());

class SplMaxHeap2 extends SplMaxHeap {
    public function compare($a, $b): int {
        return -parent::compare($a,$b);
    }
}
$h = new SplMaxHeap2();
$h->insert(1);
$h->insert(6);
$h->insert(5);
$h->insert(2);
var_dump($h->top());
?>
--EXPECT--
int(6)
int(1)

Function Calls

None

Variables

None

Stats

MD5 edbabd0da718ac5a14e2b8dd78a82030
Eval Count 0
Decode Time 96 ms