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 prev() function : usage variation - Multi-dimensional arrays --FILE-- <?php ..

Decoded Output download

*** Testing prev() : usage variations ***

Did this file decode correctly?

Original Code

--TEST--
Test prev() function : usage variation - Multi-dimensional arrays
--FILE--
<?php
/*
 * Test prev() when passed:
 * 1. a two-dimensional array
 * 2. a sub-array
 * as $array_arg argument.
 */

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

$subarray = array(9,8,7);
end($subarray);

$array_arg = array ($subarray, 'a' => 'z');
end($array_arg);

echo "\n-- Pass a two-dimensional array as \$array_arg --\n";
var_dump(prev($array_arg));
var_dump(prev($array_arg));

echo "\n-- Pass a sub-array as \$array_arg --\n";
var_dump(prev($array_arg[0]));
?>
--EXPECT--
*** Testing prev() : usage variations ***

-- Pass a two-dimensional array as $array_arg --
array(3) {
  [0]=>
  int(9)
  [1]=>
  int(8)
  [2]=>
  int(7)
}
bool(false)

-- Pass a sub-array as $array_arg --
int(8)

Function Calls

end 1

Variables

$subarray [{'key': 0, 'value': 9}, {'key': 1, 'value': 8}, {'key': 2, 'value': 7}]

Stats

MD5 0dd6e5493a79391d20e936af13b4f786
Eval Count 0
Decode Time 115 ms