MySQL Database table
Rates:
Id | Name |
---|---|
1 | $13.00 |
2 | $20.00 |
3 | $13.75 |
4 | $15.00 |
5 | $100.00 |
I'm trying to sort the data ASC to show on the dropdown, based on the data you can clearly understand that we can't sort the data by Id.
Here is the same code
$sorted = $rates;
foreach ($rates as $key => $data){
if(preg_match('/[a-z]/', $data['name'])){
unset($sorted[$key]);
$sorted[] = $data;
}
}
Result:
Expected Result:
$13.00
$13.75
$15.00
$100.00
Can you help me to figure this out?