根据爆炸项排序PHP数组

Completely new to PHP

I need to sort an array that was read in from a text file, line by line

$data = fgets($fileHandle);

Each $data contains 3 fields, which where exploded with

$otherData = explode(',',$data)

I need to sort the entire array ($data), by the first item in explode so it would be otherData[0];

from smallest to biggest, the firs item in explode is a number

how do i do this?

some research on google hasn't gotten me very far, any help is appreciated

you can take the column you want to sort as the key of the array. then sort it with ksort

$data = array();
while($dataLine = fgets($fileHandle))
{
    list($item1, $item2, $item3) = explode(',', $dataLine, 3);
    $data[$item1] = $item3;
}
ksort($data);
print_r($data);