I have this array:
$array["4E-952778"][0]['fileName'] = "File 1";
$array["4E-952778"][0]['product'] = "Muse On Demand";
$array["4E-952778"][1]['fileName'] = "File 2";
$array["4E-952778"][1]['product'] = "Muse On Demand";
$array["15210"][0]['fileName'] = "File 3";
$array["15210"][0]['product'] = "4Manager";
$array["15210"][1]['fileName'] = "File 4";
$array["15210"][1]['product'] = "4Manager";
$products = array();
foreach ($array as $key => $row) {
$products[$key] = $row[0]['product'];
}
array_multisort($products, SORT_ASC, $array);
print_r($array);
and the result is this :
Array
(
[0] => Array
(
[0] => Array
(
[fileName] => File 3
[product] => 4Manager
)
[1] => Array
(
[fileName] => File 4
[product] => 4Manager
)
)
[4E-952778] => Array
(
[0] => Array
(
[fileName] => File 1
[product] => Muse On Demand
)
[1] => Array
(
[fileName] => File 2
[product] => Muse On Demand
)
)
)
As you can observe the function array_multisort()
change the key: 15210
to 0
why this change?