<=> 2; // -1 echo 2 <=> 1; // 1 php7 PHP7で宇宙船演算子を使いこなすぞ Hiraku
http://qiita.com/Hiraku/items/62821d7d0e7af1ac211e $sampleArray = ['one', 'two', 'free', 'fore', 'five']; usort($sampleArray, function($a, $b) { return strlen($a) <=> strlen($b); }); PHP Manual usort()
http://php.net/manual/en/function.usort.php#117659