Tried everything I found on stack but nothing worked to modify my array php
one text
Solution:
<?php
$a=array('Champagne 1er Cru Le Cran Domaine Bereche 2010');
$b=array('Champagne 1er Cru Le Cran Domaine Bereche 2011 Magnum');
$c=array('Champagne 1er Cru Extra Brut Bulle de Rose Domaine Savart NV');
$d=array('Champagne 1er Cru Le Cran Domaine Bereche 2010 Magnum');
$e=array('Champagne 1er Cru Monts Fournois Domaine Bereche 2012');
$f=array('Champagne 1er Cru Brut Expression Nature Domaine Savart 2014');
$g=array('Champagne 1er Cru Le Cran Domaine Bereche 2009');
$array=array($a, $b, $c, $d, $e, $f, $g);
function sort_subregion($a, $b)
{
return strcmp($a[0], $b[0]);
}
uasort($array, 'sort_subregion');
print_r($array);
Output
Array
(
[5] => Array
(
[0] => Champagne 1er Cru Brut Expression Nature Domaine Savart 2014
)
[2] => Array
(
[0] => Champagne 1er Cru Extra Brut Bulle de Rose Domaine Savart NV
)
[6] => Array
(
[0] => Champagne 1er Cru Le Cran Domaine Bereche 2009
)
[0] => Array
(
[0] => Champagne 1er Cru Le Cran Domaine Bereche 2010
)
[3] => Array
(
[0] => Champagne 1er Cru Le Cran Domaine Bereche 2010 Magnum
)
[1] => Array
(
[0] => Champagne 1er Cru Le Cran Domaine Bereche 2011 Magnum
)
[4] => Array
(
[0] => Champagne 1er Cru Monts Fournois Domaine Bereche 2012
)
)
Source