まずはPHP7リリースおめでとうございます!!! PHP 7.0.0 Released なんだか記念すべき日にAdvent Calendarを入れてしまって恐縮です。その割にすごい小ネタで書いてしまった…。 ここから本文 PHP7では宇宙船演算子<=>が導入されます。だいたいこういう意味の演算子ですね。 // <=>と同じ意味の関数 function compare($a, $b) { if ($a < $b) { return -1; } elseif ($a > $b) { return 1; } else { return 0; } } compare(1, 2); // -1; 1 <=> 2; // -1; ユースケース的にはusort(), uasort(), uksort()との組み合わせで用いられるので、この機会にPHPにおける配列の並び替えについてまとめてみることにします
Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Enumerations Errors Exceptions Fibers Generators Attributes References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Predefined Attributes Context options and parameters Su
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く