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_diff_key() function : usage variation - Passing integer indexed array ..

Decoded Output download

*** Testing array_diff_key() : usage variation ***

--[{'key': 10, 'value': '10'}, {'key': '-17', 'value': '-17'}]--

Did this file decode correctly?

Original Code

--TEST--
Test array_diff_key() function : usage variation - Passing integer indexed array
--FILE--
<?php
echo "*** Testing array_diff_key() : usage variation ***\n";

// Initialise function arguments not being substituted (if any)
$input_array = array(-07 => '-07', 0xA => '0xA');

$input_arrays = array(
      'decimal indexed' => array(10 => '10', '-17' => '-17'),
      'octal indexed' => array(-011 => '-011', 012 => '012'),
      'hexa  indexed' => array(0x12 => '0x12', -0x7 => '-0x7', ),
);

// loop through each element of the array for arr1
foreach($input_arrays as $key =>$value) {
      echo "\n--$key--\n";
      var_dump( array_diff_key($input_array, $value) );
      var_dump( array_diff_key($value, $input_array) );
}
?>
--EXPECT--
*** Testing array_diff_key() : usage variation ***

--decimal indexed--
array(1) {
  [-7]=>
  string(3) "-07"
}
array(1) {
  [-17]=>
  string(3) "-17"
}

--octal indexed--
array(1) {
  [-7]=>
  string(3) "-07"
}
array(1) {
  [-9]=>
  string(4) "-011"
}

--hexa  indexed--
array(1) {
  [10]=>
  string(3) "0xA"
}
array(1) {
  [18]=>
  string(4) "0x12"
}

Function Calls

array_diff_key 1

Variables

$key [{'key': 10, 'value': '10'}, {'key': '-17', 'value': '-17'}]
$value [{'key': 10, 'value': '10'}, {'key': '-17', 'value': '-17'}]
$input_array [{'key': -7, 'value': '-07'}, {'key': 10, 'value': '0xA'}]
$input_arrays [{'key': 'decimal indexed', 'value': [{'key': 10, 'value': '10'}, {'key': '-17', 'value': '-17'}]}, {'key': 'octal indexed', 'value': [{'key': -9, 'value': '-011'}, {'key': 10, 'value': '012'}]}, {'key': 'hexa indexed', 'value': [{'key': 18, 'value': '0x12'}, {'key': -7, 'value': '-0x7'}]}]

Stats

MD5 6afe82467359a67d413c52c9594b088f
Eval Count 0
Decode Time 104 ms