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 krsort() function : usage variations - sort bool values --FILE-- <?php /* *..

Decoded Output download

*** Testing krsort() : usage variations ***

Did this file decode correctly?

Original Code

--TEST--
Test krsort() function : usage variations - sort bool values
--FILE--
<?php
/*
 * testing krsort() by providing array of boolean values for $array argument with following flag values:
 *  1.flag value as default
 *  2.SORT_REGULAR - compare items normally
*/

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

// bool value array
$bool_values = array (true => true, false => false, TRUE => TRUE, FALSE => FALSE);

echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is default --\n";
$temp_array = $bool_values;
var_dump(krsort($temp_array) );
var_dump($temp_array);

echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR --\n";
$temp_array = $bool_values;
var_dump(krsort($temp_array, SORT_REGULAR) );
var_dump($temp_array);

echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC  --\n";
$temp_array = $bool_values;
var_dump(krsort($temp_array, SORT_NUMERIC) );
var_dump($temp_array);

echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING --\n";
$temp_array = $bool_values;
var_dump(krsort($temp_array, SORT_STRING) );
var_dump($temp_array);

echo "Done\n";
?>
--EXPECT--
*** Testing krsort() : usage variations ***

-- Testing krsort() by supplying boolean value array, 'flag' value is default --
bool(true)
array(2) {
  [1]=>
  bool(true)
  [0]=>
  bool(false)
}

-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_REGULAR --
bool(true)
array(2) {
  [1]=>
  bool(true)
  [0]=>
  bool(false)
}

-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_NUMERIC  --
bool(true)
array(2) {
  [1]=>
  bool(true)
  [0]=>
  bool(false)
}

-- Testing krsort() by supplying boolean value array, 'flag' value is SORT_STRING --
bool(true)
array(2) {
  [1]=>
  bool(true)
  [0]=>
  bool(false)
}
Done

Function Calls

None

Variables

None

Stats

MD5 41966d4a37f4ace855a7e7aefa6fcb24
Eval Count 0
Decode Time 130 ms