What are the differences in functionality when using array_filter() with and without a callback function in PHP?

When using array_filter() without a callback function in PHP, it will remove any empty or false values from the array. However, when using a callback function, you can define custom logic to filter the array based on specific criteria. This allows for more flexibility in filtering arrays based on complex conditions.

// Using array_filter() without a callback function
$array = [1, 0, false, 2, '', 3];
$filteredArray = array_filter($array);
print_r($filteredArray); // Output: [1, 2, 3]

// Using array_filter() with a callback function
$array = [1, 2, 3, 4, 5];
$filteredArray = array_filter($array, function($value) {
    return $value % 2 == 0; // Filter even numbers
});
print_r($filteredArray); // Output: [2, 4]