What function in PHP can be used to sort an array based on a custom comparison function?

To sort an array based on a custom comparison function in PHP, you can use the `usort()` function. This function allows you to define a custom comparison function that will be used to determine the sorting order of the elements in the array. The custom comparison function should return a negative value if the first element should come before the second, a positive value if the first element should come after the second, and zero if they are equal.

// Define a custom comparison function
function customCompare($a, $b) {
    if ($a == $b) {
        return 0;
    }
    return ($a < $b) ? -1 : 1;
}

// Create an array to be sorted
$array = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5];

// Sort the array using the custom comparison function
usort($array, 'customCompare');

// Output the sorted array
print_r($array);