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-- Bug #41686 (Omitting length param in array_slice not possible) --FILE-- <?php $a ..

Decoded Output download

--TEST--
Bug #41686 (Omitting length param in array_slice not possible)
--FILE--
<?php
$a = array(1,2,3);
$b = array('a'=>1,'b'=>1,'c'=>2);

var_dump(
        array_slice($a, 1),
        array_slice($a, 1, 2, TRUE),
        array_slice($a, 1, NULL, TRUE),
        array_slice($b, 1),
        array_slice($b, 1, 2, TRUE),
        array_slice($b, 1, NULL, TRUE)
);

echo "Done
";
?>
--EXPECT--
array(2) {
  [0]=>
  int(2)
  [1]=>
  int(3)
}
array(2) {
  [1]=>
  int(2)
  [2]=>
  int(3)
}
array(2) {
  [1]=>
  int(2)
  [2]=>
  int(3)
}
array(2) {
  ["b"]=>
  int(1)
  ["c"]=>
  int(2)
}
array(2) {
  ["b"]=>
  int(1)
  ["c"]=>
  int(2)
}
array(2) {
  ["b"]=>
  int(1)
  ["c"]=>
  int(2)
}
Done

Did this file decode correctly?

Original Code

--TEST--
Bug #41686 (Omitting length param in array_slice not possible)
--FILE--
<?php
$a = array(1,2,3);
$b = array('a'=>1,'b'=>1,'c'=>2);

var_dump(
        array_slice($a, 1),
        array_slice($a, 1, 2, TRUE),
        array_slice($a, 1, NULL, TRUE),
        array_slice($b, 1),
        array_slice($b, 1, 2, TRUE),
        array_slice($b, 1, NULL, TRUE)
);

echo "Done\n";
?>
--EXPECT--
array(2) {
  [0]=>
  int(2)
  [1]=>
  int(3)
}
array(2) {
  [1]=>
  int(2)
  [2]=>
  int(3)
}
array(2) {
  [1]=>
  int(2)
  [2]=>
  int(3)
}
array(2) {
  ["b"]=>
  int(1)
  ["c"]=>
  int(2)
}
array(2) {
  ["b"]=>
  int(1)
  ["c"]=>
  int(2)
}
array(2) {
  ["b"]=>
  int(1)
  ["c"]=>
  int(2)
}
Done

Function Calls

array_slice 1

Variables

$a [{'key': 0, 'value': 1}, {'key': 1, 'value': 2}, {'key': 2, 'value': 3}]
$b [{'key': 'a', 'value': 1}, {'key': 'b', 'value': 1}, {'key': 'c', 'value': 2}]

Stats

MD5 85f8d783e342b773d44c3eeed09b20de
Eval Count 0
Decode Time 95 ms