基于数组值对数组进行排序

For an instance you have an array:

$unsorted = array(
    'desert' => array(
        'time' => '1339902235',
        'name' => 'desert.jpg'
    ),
    'sea' => array(
        'time' => '1339900801',
        'name' => 'sea.jpg'
    ),
    'mountain' => array(
        'time' => '1339902285',
        'name' => 'mountain.jpg'
    ),
);

Would it be possible to sort the array by the value of $unsorted[$a]['time']?

You can use something like usort and strnatcasecmp.

For example:

function sort_2d_asc($array, $key) {
    usort($array, function($a, $b) use ($key) {
        return strnatcasecmp($a[$key], $b[$key]);
    });

    return $array;
}

function sort_2d_desc($array, $key) {
    usort($array, function($a, $b) use ($key) {
        return strnatcasecmp($b[$key], $a[$key]);
    });

    return $array;
}

$unsorted = array(
    'desert' => array(
        'time' => '1339902235',
        'name' => 'desert.jpg'
    ),
    'sea' => array(
        'time' => '1339900801',
        'name' => 'sea.jpg'
    ),
    'mountain' => array(
        'time' => '1339902285',
        'name' => 'mountain.jpg'
    ),
);

$sorted = sort_2d_asc($unsorted, 'time');

You can using usort. usort takes a callback as an argument. Also convert time to integers because that's what they are.

function compare($a,$b) {
     if( $a['time'] == $b['time'] ) {
         return 0;
     }

     return (intval($a['time']) < intval($b['time'])) ? -1 : 1;
}

usort( $unsorted, 'compare' );

// $unsorted is now sorted by time

Note that usort doesn't preserve keys.
If you need original keys you should use uasort.