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-- Test array_slice() function : usage variations - multidimensional arrays --FILE--..

Decoded Output download

*** Testing array_slice() : usage variations ***

-- Slice a two-dimensional array --

Did this file decode correctly?

Original Code

--TEST--
Test array_slice() function : usage variations - multidimensional arrays
--FILE--
<?php
/*
 * Test array_slice when passed
 * 1. a two-dimensional array as $input argument
 * 2. a sub-array as $input argument
 */

echo "*** Testing array_slice() : usage variations ***\n";

$input = array ('zero', 'one', array('zero', 'un', 'deux'), 9 => 'nine');

echo "\n-- Slice a two-dimensional array --\n";
var_dump(array_slice($input, 1, 3));

echo "\n-- \$input is a sub-array --\n";
var_dump(array_slice($input[2], 1, 2));

echo "Done";
?>
--EXPECT--
*** Testing array_slice() : usage variations ***

-- Slice a two-dimensional array --
array(3) {
  [0]=>
  string(3) "one"
  [1]=>
  array(3) {
    [0]=>
    string(4) "zero"
    [1]=>
    string(2) "un"
    [2]=>
    string(4) "deux"
  }
  [2]=>
  string(4) "nine"
}

-- $input is a sub-array --
array(2) {
  [0]=>
  string(2) "un"
  [1]=>
  string(4) "deux"
}
Done

Function Calls

array_slice 1

Variables

$input [{'key': 0, 'value': 'zero'}, {'key': 1, 'value': 'one'}, {'key': 2, 'value': [{'key': 0, 'value': 'zero'}, {'key': 1, 'value': 'un'}, {'key': 2, 'value': 'deux'}]}, {'key': 9, 'value': 'nine'}]

Stats

MD5 f679967a2191f4cacdde72b4912d1969
Eval Count 0
Decode Time 100 ms