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

Decoded Output download

*** Testing array_diff_ukey() : usage variation ***

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

Did this file decode correctly?

Original Code

--TEST--
Test array_diff_ukey() function : usage variation - Passing integer indexed array
--FILE--
<?php
echo "*** Testing array_diff_ukey() : 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', ),
);

function key_compare_func($key1, $key2)
{
  return strcasecmp($key1, $key2);
}

foreach($input_arrays as $key =>$value) {
      echo "\n--$key--\n";
      var_dump( array_diff_ukey($value, $input_array, 'key_compare_func') );
      var_dump( array_diff_ukey($input_array, $value, 'key_compare_func') );
}
?>
--EXPECT--
*** Testing array_diff_ukey() : usage variation ***

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

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

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

Function Calls

array_diff_ukey 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 ca8a1cc9d29863adf87ab6fabbf5e43d
Eval Count 0
Decode Time 100 ms