There was a task to sort an array coming from a DB. One element from this array looks like this:
Array ( [id] => 261 [category] => 1 [subcategory] => 83 [name] => Гель-краска 10 г цвет 02 [name_tr] => [description] =>[description_tr] =>[price-usd] => [price-usd-promo] => [price-try] => [price-try-promo] => [price-rub] => [price-rub-promo] => [image] => 02в.jpg [sku] => [status] => 1 [novelty] => [recommended] => [promo] => [sales] => [hits] => [type] => 2 [volume] => [width] => [height] => [thickness] => [weight] => [material] => [abrasiveness] => [seo_title] => [seo_description] => [seo_keywords] => ) It is necessary to sort this array by the name field in ascending order. Names for one category do not change, but change for another. At the end there is always a number of the form
01, 02, 021
You can sort by SQL query
$sql ="SELECT * FROM c_products WHERE category = '".$category[0]['id']."' AND status = '1' AND subcategory = '".$subcategory[0]['id']."' ORDER BY name ASC LIMIT $offset,$num ";
With existing sorting is displayed as follows
01, 011, 012, 02, 020