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: DoublyLinkedList: insert operations --FILE-- <?php $dll = new SplDoublyLinke..
Decoded Output download
--TEST--
SPL: DoublyLinkedList: insert operations
--FILE--
<?php
$dll = new SplDoublyLinkedList();
// errors
try {
$dll->add(2,5);
} catch (OutOfRangeException $e) {
echo "Exception: ".$e->getMessage()."
";
}
$dll->add(0,6); // 6
$dll->add(0,3); // 3 6
// Insert in the middle of the DLL
$dll->add(1,4); // 3 4 6
$dll->add(2,5); // 3 4 5 6
$dll->unshift(2); // 2 3 5 4 6
// Insert at the beginning and end of the DLL
$dll->add(0,1); // 1 2 3 4 5 6
$dll->add(6,7); // 1 2 3 4 5 6 7
echo count($dll)."
";
echo $dll->pop()."
";
echo $dll->pop()."
";
echo $dll->pop()."
";
echo $dll->pop()."
";
echo $dll->pop()."
";
echo $dll->pop()."
";
echo $dll->pop()."
";
// Test refcounted value
$str = "foo";
$str .= "bar";
$dll->add(0, $str);
$dll->add(0, $str);
var_dump($dll->shift());
var_dump($dll->shift());
?>
--EXPECT--
Exception: SplDoublyLinkedList::add(): Argument #1 ($index) is out of range
7
7
6
5
4
3
2
1
string(6) "foobar"
string(6) "foobar"
Did this file decode correctly?
Original Code
--TEST--
SPL: DoublyLinkedList: insert operations
--FILE--
<?php
$dll = new SplDoublyLinkedList();
// errors
try {
$dll->add(2,5);
} catch (OutOfRangeException $e) {
echo "Exception: ".$e->getMessage()."\n";
}
$dll->add(0,6); // 6
$dll->add(0,3); // 3 6
// Insert in the middle of the DLL
$dll->add(1,4); // 3 4 6
$dll->add(2,5); // 3 4 5 6
$dll->unshift(2); // 2 3 5 4 6
// Insert at the beginning and end of the DLL
$dll->add(0,1); // 1 2 3 4 5 6
$dll->add(6,7); // 1 2 3 4 5 6 7
echo count($dll)."\n";
echo $dll->pop()."\n";
echo $dll->pop()."\n";
echo $dll->pop()."\n";
echo $dll->pop()."\n";
echo $dll->pop()."\n";
echo $dll->pop()."\n";
echo $dll->pop()."\n";
// Test refcounted value
$str = "foo";
$str .= "bar";
$dll->add(0, $str);
$dll->add(0, $str);
var_dump($dll->shift());
var_dump($dll->shift());
?>
--EXPECT--
Exception: SplDoublyLinkedList::add(): Argument #1 ($index) is out of range
7
7
6
5
4
3
2
1
string(6) "foobar"
string(6) "foobar"
Function Calls
None |
Stats
MD5 | f5066839c350a65b8fdb837057d05c65 |
Eval Count | 0 |
Decode Time | 143 ms |