Сортировка массива по ключу

PHP 5.2

<span class="kwd">function</span><span class="pln"> sortByOrder</span><span class="pun">(</span><span class="pln">$a</span><span class="pun">,</span><span class="pln"> $b</span><span class="pun">)</span> <span class="pun">{</span>
    <span class="kwd">return</span><span class="pln"> $a</span><span class="pun">[</span><span class="str">'order'</span><span class="pun">]</span> <span class="pun">-</span><span class="pln"> $b</span><span class="pun">[</span><span class="str">'order'</span><span class="pun">];</span>
<span class="pun">}</span><span class="pln">
usort</span><span class="pun">(</span><span class="pln">$myArray</span><span class="pun">,</span> <span class="str">'sortByOrder'</span><span class="pun">);</span>

PHP 5.3

<span class="pln">usort</span><span class="pun">(</span><span class="pln">$myArray</span><span class="pun">,</span> <span class="kwd">function</span><span class="pun">(</span><span class="pln">$a</span><span class="pun">,</span><span class="pln"> $b</span><span class="pun">)</span> <span class="pun">{</span>
    <span class="kwd">return</span><span class="pln"> $a</span><span class="pun">[</span><span class="str">'order'</span><span class="pun">]</span> <span class="pun">-</span><span class="pln"> $b</span><span class="pun">[</span><span class="str">'order'</span><span class="pun">];</span>
<span class="pun">});</span>

PHP 7

<span class="pln">usort</span><span class="pun">(</span><span class="pln">$myArray</span><span class="pun">,</span> <span class="kwd">function</span><span class="pun">(</span><span class="pln">$a</span><span class="pun">,</span><span class="pln"> $b</span><span class="pun">)</span> <span class="pun">{</span>
    <span class="kwd">return</span><span class="pln"> $a</span><span class="pun">[</span><span class="str">'order'</span><span class="pun">]</span> <span class="pun"><=></span><span class="pln"> $b</span><span class="pun">[</span><span class="str">'order'</span><span class="pun">];</span>
<span class="pun">});</span>
Excel шаблоны для Scrum Product и Sprint Backlogs

Вот несколько полезных шаблонов для управления Скрам проектами в Excel.

Почему именно Excel? Все просто. Как мне кажется там все очень просто... Попробуйте и оцените. (далее…)