2016-09-30 50 views
-1

我想這個排序按字母順序排列。我很確定我的陣列我這兒過得在foreach循環 這裏調用它是我的代碼:排序靜態數組PHP

private static $table_prefixes = [ 
     'alio', 
     'dan_travel', 
     'goway_ca', 
     'goway_us', 
     'picasso', 
     'transam' 
]; 

    public $suppliers_overview = []; 
public static function getTablePrefixes() 
    { 
     return self::$table_prefixes; 
    } 

foreach (self::getTablePrefixes() as $prefix) { 

      $this->suppliers_overview[$prefix]['name'] =$prefix; 
} 
+0

[PHP sort array()](http://stackoverflow.com/questions/9380106/php-sort-array)可能的重複 –

回答

0

可以在地方試試這個您的foreach

$this->suppliers_overview[] = array_sort_recursive(self::getTablePrefixes());