How can you sort an array by a specific column, such as a postal code, in PHP?
To sort an array by a specific column, such as a postal code, in PHP, you can use the `array_multisort()` function. This function allows you to sort multiple arrays or a multi-dimensional array by one or more columns. You can specify the column you want to sort by and the sorting order (ascending or descending).
// Sample array with postal codes
$data = array(
array('name' => 'John', 'postal_code' => '12345'),
array('name' => 'Alice', 'postal_code' => '54321'),
array('name' => 'Bob', 'postal_code' => '23456')
);
// Sort the array by postal code in ascending order
array_multisort(array_column($data, 'postal_code'), SORT_ASC, $data);
// Display the sorted array
print_r($data);