What is the significance of the custom function used in usort when sorting arrays in PHP?

When sorting arrays in PHP using `usort`, a custom function can be used to define the sorting criteria based on specific elements or conditions within the array. This allows for a more flexible and customized way of sorting arrays compared to the default sorting methods provided by PHP.

// Example of using a custom function with usort to sort an array of names alphabetically
$names = ['John', 'Alice', 'Bob', 'Eve'];

usort($names, function($a, $b) {
    return strcmp($a, $b);
});

print_r($names);