The following files exists in this folder. Click to view.
phpdoc-cache-file_78cd5aa3783a74555c9938a2a81d01c6.dat1 lines ASCII Unix (LF) O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"ecb66df8240b19c15a62525d8be1bbf7";s:7:" * path";s:13:"functions.php";s:9:" * source";s:1722:"<?php
/**
* Bootstrapping functions, essential and needed for Anax to work together with some common helpers.
*
*/
/**
* Utility for debugging.
*
* @param mixed $array values to print out
*
* @return void
*/
function dump($array)
{
echo "<pre>" . htmlentities(print_r($array, 1)) . "</pre>";
}
/**
* Sort array but maintain index when compared items are equal.
* http://www.php.net/manual/en/function.usort.php#38827
*
* @param array &$array input array
* @param callable $cmp_function custom function to compare values
*
* @return void
*
*/
function mergesort(&$array, $cmp_function)
{
// Arrays of size < 2 require no action.
if (count($array) < 2) return;
// Split the array in half
$halfway = count($array) / 2;
$array1 = array_slice($array, 0, $halfway);
$array2 = array_slice($array, $halfway);
// Recurse to sort the two halves
mergesort($array1, $cmp_function);
mergesort($array2, $cmp_function);
// If all of $array1 is <= all of $array2, just append them.
if (call_user_func($cmp_function, end($array1), $array2[0]) < 1) {
$array = array_merge($array1, $array2);
return;
}
// Merge the two sorted arrays into a single sorted array
$array = array();
$ptr1 = $ptr2 = 0;
while ($ptr1 < count($array1) && $ptr2 < count($array2)) {
if (call_user_func($cmp_function, $array1[$ptr1], $array2[$ptr2]) < 1) {
$array[] = $array1[$ptr1++];
} else {
$array[] = $array2[$ptr2++];
}
}
// Merge the remainder
while ($ptr1 < count($array1)) $array[] = $array1[$ptr1++];
while ($ptr2 < count($array2)) $array[] = $array2[$ptr2++];
return;
}
";s:19:"