What is the purpose of using array_map in the PHP code snippet provided?

The purpose of using array_map in the PHP code snippet is to apply a given callback function to each element of an array and return a new array with the results.

// Original array
$numbers = [1, 2, 3, 4, 5];

// Function to double each number
function double($num) {
    return $num * 2;
}

// Using array_map to apply the 'double' function to each element of the array
$doubled_numbers = array_map('double', $numbers);

// Output the doubled numbers
print_r($doubled_numbers);