2016-04-11 13 views

Antwort

1

haben einen Blick auf http://php.net/manual/en/function.sort.php, hier können Sie zweiten Parameter verwenden, das heißt sort_flags

$ciao ="4,[email protected],[email protected],[email protected],a"; // Can have other elements 
$prova = explode("@",$ciao); 
sort($prova, SORT_STRING); //SORT_STRING - compare items as strings 
print_r($prova); 

sort($prova, SORT_NUMERIC); //SORT_NUMERIC - compare items numerically 
print_r($prova); 

Ausgang

Array 
(
    [0] => 1,x 
    [1] => 2,f 
    [2] => 22,a 
    [3] => 4,v 
) 
Array 
(
    [0] => 1,x 
    [1] => 2,f 
    [2] => 4,v 
    [3] => 22,a 
)