{"id":283866,"date":"2017-03-24T15:35:02","date_gmt":"2017-03-24T12:35:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=283866"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=283866","title":{"rendered":"\u041f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u0432\u0430\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u043d\u0430 PHP (\u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435, \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b)"},"content":{"rendered":"<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0425\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u0432\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430. \u041f\u0440\u043e\u0435\u043a\u0442 \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0443\u0447\u0435\u0431\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445. <br \/>  \u041a\u043e\u0433\u0434\u0430 \u043c\u0435\u043d\u044f \u0440\u0430\u043d\u044c\u0448\u0435 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u043b\u0438 \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u043e\u0431 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u044f \u0442\u0435\u0440\u044f\u043b\u0441\u044f \u0438 \u0441\u0447\u0438\u0442\u0430\u043b, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439 \u043d\u0430\u0434\u043e \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0442\u0430\u043b\u0430\u043d\u0442\u043b\u0438\u0432\u044b\u043c \u043e\u0442\u043b\u0438\u0447\u043d\u0438\u043a\u043e\u043c-\u043e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u043d\u0438\u043a\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e-\u0434\u043e\u043b\u0433\u043e-\u043c\u0430\u043b\u043e\u0438\u0437\u0443\u0447\u0435\u043d\u043e \u0438 \u0442.\u043f. \ud83d\ude42 \u0422\u0430\u043a \u0436\u0435 \u044f \u043d\u0430\u0445\u043e\u0434\u0438\u043b \u043a\u0443\u0440\u0441\u044b, \u0433\u0434\u0435 \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0434\u0435\u043b\u044c (\u043c\u0435\u0441\u044f\u0446\u0435\u0432) \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0432\u0441\u0435\u043c\u0443-\u0432\u0441\u0435\u043c\u0443 \u043f\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c, \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430\u043c, \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u041d\u043e \u0432\u0435\u0434\u044c \u0441\u0435\u0439\u0447\u0430\u0441 \u0435\u0441\u0442\u044c \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0430 \u0432 \u043d\u0435\u043c \u0443\u0436\u0435 \u0432\u0441\u0435 \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u043e \u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e? \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0438 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f.<br \/>  \u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0430\u043c\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (PHPUnit) \u0438 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 (\u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0437\u044b\u043a\u0430 VS \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434).<br \/>  \u0422.\u0435. \u043a\u0430\u043a \u0431\u044b \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0435\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438) \u0438 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0432\u0441\u0435\u043c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u044d\u0442\u0430\u043f\u0430\u043c (\u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043d\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u00ab\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432\u00bb \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438).<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a73\/8f8\/2ef\/a738f82ef2a84b3995ab9e52240128dd.jpg\"\/><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u0432\u0430\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430<\/h3>\n<p>  \u041d\u0410 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438 \u0438 \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0438 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432\u0441\u0435 \u0432\u0438\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430. \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b, \u0430 \u043d\u0430 \u042e\u0442\u0443\u0431\u0435 \u0435\u0441\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0432\u0438\u0434\u0430\u043c\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043e\u043a \u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432.<br \/>  \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0432\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u043b\u0441\u044f \u0432 \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0442\u0430\u043a\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 (\u0434\u043b\u044f \u0447\u0438\u0441\u0442\u043e\u0442\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430), \u0430 \u043b\u0438\u0448\u044c \u0447\u0438\u0442\u0430\u043b \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438. \u041d\u0430\u0447\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043f\u043e\u0434\u0431\u0440\u043e\u0441\u0438\u043b \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u0438 \u0441\u043c\u043e\u0442\u0440\u044e \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d! \u0412 \u0433\u043e\u043b\u043e\u0432\u0435 \u043b\u0435\u0433\u043a\u0430\u044f \u043f\u0430\u043d\u0438\u043a\u0430! \u0427\u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0435 \u0442\u0430\u043a? \u0413\u0434\u0435 \u043e\u0448\u0438\u0431\u043a\u0430? \u041e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435\u0442 \u2014 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0432\u0435\u0440\u043d\u043e. \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0432\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u0432\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438?! \u041f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 \u044f \u0440\u0430\u043d\u044c\u0448\u0435 \u0441\u0447\u0438\u0442\u0430\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u043e \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0435 \u0432\u0441\u0435\u043c?<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">    \/**      *       * @param array $data      * @return array      *\/     public function sort(array $data)      {         $count_elements = count($data);          $iterations = $count_elements - 1;         for ($i=0; $i &lt; $count_elements; $i++) {             for ($j=0; $j &lt; $iterations; $j++) {                 if ($data[$j] &gt; $data[($j + 1)]) {                     list($data[$j], $data[($j + 1)]) = array($data[($j + 1)], $data[$j]);                 }             }             $iterations--;         }                  return $data;     }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3>\u0411\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a<\/h3>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0434\u0430\u043b\u0430\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0440\u0443\u0434\u043d\u0435\u0435. \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u043a\u043e\u0434, \u0443\u0434\u0430\u043b\u044f\u043b \u0438 \u0437\u0430\u043d\u043e\u0432\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0430\u043b \u0435\u0433\u043e. \u0427\u0430\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0448\u043b\u0430 \u043d\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0438\u0441\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<br \/>  \u041d\u043e \u0432\u0441\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u044f \u043d\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u00ab\u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0433\u043e \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u00bb \ud83d\ude42<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">    \/**      *      * @param int $element      * @return mixed      *\/     public function search(int $element, array $data)     {         $begin = 0;         $end = count($data) - 1;         $prev_begin = $begin;         $prev_end = $end;         while (true) {             $position = round(($begin + $end) \/ 2);                          if (isset($data[$position])) {                 if ($data[$position] == $element) {                     return $position;                 }                 if ($data[$position] &gt; $element) {                     $end = floor(($begin + $end) \/ 2);                 } elseif ($data[$position] &lt; $element) {                     $begin = ceil(($begin + $end) \/ 2);                 }             }             if ($prev_begin == $begin && $prev_end == $end) {                 return false;             }             $prev_begin = $begin;             $prev_end = $end;         }     }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430<\/h3>\n<p>  \u041a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0440\u0430\u0437\u043d\u0435\u0441\u0435\u043d \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u0430\u043c. \u041b\u043e\u0433\u0438\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u043a\u043e\u0434 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0438, \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u043d\u0435\u0441\u0435\u043c \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430.<br \/>  \u041f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0431\u044b\u043b\u0438 \u0443\u0447\u0442\u0435\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 <b>\u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438<\/b>:  <\/p>\n<ul>\n<li>\u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 0 \/ 1 \/ 2 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/li>\n<li>\u043f\u0435\u0440\u0432\u044b\u0439 \/ \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442<\/li>\n<li>\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043d\u0435\u0442<\/li>\n<li>\u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">class BinarySearchTest extends PHPUnit_Framework_TestCase  {     \/**      *      * @var BinarySearch       *\/     public $binary;     \/**      *      * @var array      *\/     public $empty_data = [];     \/**      *      * @var array      *\/     public $one_element = [1];      \/**      *      * @var array      *\/     public $two_elements = [1,2];        \/**      *      * @var array      *\/         public $many_elements = [-189, -55, -34, -9, 0, 1, 6, 9, 10, 12, 25, 45, 67, 287, 633, 673, 783, 942];          public function setUp()      {         $this-&gt;binary = new BinarySearch();     }     public function tearDown()      {              }     public function testEmptyData()      {         $result = $this-&gt;binary-&gt;search(1, $this-&gt;empty_data);         $this-&gt;assertEquals($result, false);     }          public function testOneElement()      {         $result = $this-&gt;binary-&gt;search(1, $this-&gt;one_element);         $this-&gt;assertEquals($result, 0);                  $result = $this-&gt;binary-&gt;search(2, $this-&gt;one_element);         $this-&gt;assertEquals($result, false);     }              public function testTwoElements()      {         $result = $this-&gt;binary-&gt;search(1, $this-&gt;two_elements);         $this-&gt;assertEquals($result, 0);                  $result = $this-&gt;binary-&gt;search(2, $this-&gt;two_elements);         $this-&gt;assertEquals($result, 1);             }              public function testManyElements()      {         $result = $this-&gt;binary-&gt;search(-34, $this-&gt;many_elements);         $this-&gt;assertEquals($result, 2);                  $result = $this-&gt;binary-&gt;search(-1, $this-&gt;many_elements);         $this-&gt;assertEquals($result, false);                   $result = $this-&gt;binary-&gt;search(0, $this-&gt;many_elements);         $this-&gt;assertEquals($result, 4);          $result = $this-&gt;binary-&gt;search(11, $this-&gt;many_elements);         $this-&gt;assertEquals($result, false);          $result = $this-&gt;binary-&gt;search(25, $this-&gt;many_elements);         $this-&gt;assertEquals($result, 10);          $result = $this-&gt;binary-&gt;search(673, $this-&gt;many_elements);         $this-&gt;assertEquals($result, 15);              }          public function testLastFirstElement()      {         $result = $this-&gt;binary-&gt;search(-189, $this-&gt;many_elements);         $this-&gt;assertEquals($result, 0);                  $result = $this-&gt;binary-&gt;search(942, $this-&gt;many_elements);         $this-&gt;assertEquals($result, 17);      }               public function testOutsideData()      {         $result = $this-&gt;binary-&gt;search(-479, $this-&gt;many_elements);         $this-&gt;assertEquals($result, false);                  $result = $this-&gt;binary-&gt;search(1294, $this-&gt;many_elements);         $this-&gt;assertEquals($result, false);      }           }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u0432\u0430\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">class BubbleSortTest extends PHPUnit_Framework_TestCase  {     \/**      *      * @var BubbleSort       *\/     public $bubble;     \/**      *      * @var array      *\/     public $unsorted_data = [2, 0, -1, 3, 1];     \/**      *      * @var array      *\/         public $sorted_data = [-1, 0, 1, 2, 3];     public function setUp()      {         $this-&gt;bubble = new BubbleSort();     }     public function tearDown()      {              }     public function testSort()      {         $sorted_data = $this-&gt;bubble-&gt;sort($this-&gt;unsorted_data);         $this-&gt;assertInternalType('array', $sorted_data);         $this-&gt;assertEquals($sorted_data, $this-&gt;sorted_data);     } }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3>\u041d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0444\u0430\u0439\u043b\u0430 \u0442\u0435\u0441\u0442\u043e\u0432<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">set_time_limit(0); include 'src\/BinarySearch.php'; include 'src\/BubbleSort.php'; include 'lib\/Benchmark.php'; $benchmark = new Benchmark(); $array_100 = []; $array_1000 = []; $array_10000 = []; $array_100000 = []; $array_1000000 = []; for ($i=0; $i&lt;100; $i++) {     $array_100[] = mt_rand(0, 100); } for ($i=0; $i&lt;1000; $i++) {     $array_1000[] = mt_rand(0, 1000); } for ($i=0; $i&lt;10000; $i++) {     $array_10000[] = mt_rand(0, 10000); } for ($i=0; $i&lt;100000; $i++) {     $array_100000[] = mt_rand(0, 100000); } for ($i=0; $i&lt;1000000; $i++) {     $array_100000[] = mt_rand(0, 1000000); } $array_100_copy = $array_100; $array_1000_copy = $array_1000; $array_10000_copy = $array_10000; \/**  * Test bubble sort  *\/ $bubble = new BubbleSort(); $benchmark-&gt;mark('begin_sort_100');  sort($array_100); $sort_100 = $benchmark-&gt;elapsedTime('begin_sort_100', 'end_sort_100');  $benchmark-&gt;mark('begin_sort_100_copy'); $bubble-&gt;sort($array_100_copy); $sort_100_copy = $benchmark-&gt;elapsedTime('begin_sort_100_copy', 'end_sort_100_copy');  $benchmark-&gt;mark('begin_sort_1000');  sort($array_1000); $sort_1000 = $benchmark-&gt;elapsedTime('begin_sort_1000', 'end_sort_1000');  $benchmark-&gt;mark('begin_sort_1000_copy'); $bubble-&gt;sort($array_1000_copy); $sort_1000_copy = $benchmark-&gt;elapsedTime('begin_sort_1000_copy', 'end_sort_1000_copy'); $benchmark-&gt;mark('begin_sort_10000');  sort($array_10000); $sort_10000 = $benchmark-&gt;elapsedTime('begin_sort_10000', 'end_sort_10000');  $benchmark-&gt;mark('begin_sort_10000_copy'); $bubble-&gt;sort($array_10000_copy); $sort_10000_copy = $benchmark-&gt;elapsedTime('begin_sort_10000_copy', 'end_sort_10000_copy'); \/**  * Test binary search  *\/ $binary = new BinarySearch(); sort($array_100); sort($array_1000); sort($array_10000); sort($array_100000); sort($array_1000000); reset($array_100); reset($array_1000); reset($array_10000); reset($array_100000); reset($array_1000000); $benchmark-&gt;mark('begin_search_100');  $position = array_search(50, $array_100); $search_100 = $benchmark-&gt;elapsedTime('begin_search_100', 'end_search_100', 6); $benchmark-&gt;mark('begin_search_100_in_array');  $position = in_array(50, $array_100); $search_100_in_array = $benchmark-&gt;elapsedTime('begin_search_100_in_array', 'end_search_100_in_array', 6); $benchmark-&gt;mark('begin_search_100_second'); $position = $binary-&gt;search(50, $array_100); $search_100_second = $benchmark-&gt;elapsedTime('begin_search_100_second', 'end_search_100_second', 6); $benchmark-&gt;mark('begin_search_1000');  $position = array_search(50, $array_1000); $search_1000 = $benchmark-&gt;elapsedTime('begin_search_1000', 'end_search_1000', 6); $benchmark-&gt;mark('begin_search_1000_in_array');  $position = in_array(50, $array_1000); $search_1000_in_array = $benchmark-&gt;elapsedTime('begin_search_1000_in_array', 'end_search_1000_in_array', 6); $benchmark-&gt;mark('begin_search_1000_second'); $position = $binary-&gt;search(50, $array_1000); $search_1000_second = $benchmark-&gt;elapsedTime('begin_search_1000_second', 'end_search_1000_second', 6); $benchmark-&gt;mark('begin_search_10000');  $position = array_search(50, $array_10000); $search_10000 = $benchmark-&gt;elapsedTime('begin_search_10000', 'end_search_10000', 6); $benchmark-&gt;mark('begin_search_10000_in_array');  $position = in_array(50, $array_10000); $search_10000_in_array = $benchmark-&gt;elapsedTime('begin_search_10000_in_array', 'end_search_10000_in_array', 6); $benchmark-&gt;mark('begin_search_10000_second'); $position = $binary-&gt;search(50, $array_10000); $search_10000_second = $benchmark-&gt;elapsedTime('begin_search_10000_second', 'end_search_10000_second', 6); $benchmark-&gt;mark('begin_search_100000');  $position = array_search(50, $array_100000); $search_100000 = $benchmark-&gt;elapsedTime('begin_search_100000', 'end_search_100000', 6); $benchmark-&gt;mark('begin_search_100000_in_array');  $position = in_array(50, $array_100000); $search_100000_in_array = $benchmark-&gt;elapsedTime('begin_search_100000_in_array', 'end_search_100000_in_array', 6); $benchmark-&gt;mark('begin_search_100000_second'); $position = $binary-&gt;search(50, $array_100000); $search_100000_second = $benchmark-&gt;elapsedTime('begin_search_100000_second', 'end_search_100000_second', 6); $benchmark-&gt;mark('begin_search_1000000');  $position = array_search(50, $array_1000000); $search_1000000 = $benchmark-&gt;elapsedTime('begin_search_1000000', 'end_search_1000000', 6); $benchmark-&gt;mark('begin_search_1000000_in_array');  $position = in_array(50, $array_1000000); $search_1000000_in_array = $benchmark-&gt;elapsedTime('begin_search_1000000_in_array', 'end_search_1000000_in_array', 6); $benchmark-&gt;mark('begin_search_1000000_second'); $position = $binary-&gt;search(50, $array_1000000); $search_1000000_second = $benchmark-&gt;elapsedTime('begin_search_1000000_second', 'end_search_1000000_second', 6); ?&gt;  &lt;h3&gt;\u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430, \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b&lt;\/h3&gt;  &lt;table&gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;th&gt;                              &lt;\/th&gt;             &lt;th&gt;                 PHP::sort()                 &lt;br&gt;\u0441\u0435\u043a.             &lt;\/th&gt;             &lt;th&gt;                 BubbleSort()-&gt;sort()                 &lt;br&gt;\u0441\u0435\u043a.             &lt;\/th&gt;                     &lt;\/tr&gt;     &lt;\/thead&gt;     &lt;tbody&gt;         &lt;tr&gt;             &lt;td&gt;                 \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432             &lt;\/td&gt;             &lt;td&gt;&lt;?=$sort_100?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$sort_100_copy?&gt;&lt;\/td&gt;                     &lt;\/tr&gt;           &lt;tr&gt;             &lt;td&gt;                 \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 1000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432             &lt;\/td&gt;             &lt;td&gt;&lt;?=$sort_1000?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$sort_1000_copy?&gt;&lt;\/td&gt;                      &lt;\/tr&gt;           &lt;tr&gt;             &lt;td&gt;                 \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 10000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432             &lt;\/td&gt;             &lt;td&gt;&lt;?=$sort_10000?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$sort_10000_copy?&gt;&lt;\/td&gt;                        &lt;\/tr&gt;       &lt;\/tbody&gt;     &lt;\/table&gt;  &lt;h3&gt;\u041f\u043e\u0438\u0441\u043a \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b&lt;\/h3&gt; &lt;table&gt;     &lt;thead&gt;         &lt;tr&gt;             &lt;th&gt;                              &lt;\/th&gt;             &lt;th&gt;                 PHP::array_search()                 &lt;br&gt;\u0441\u0435\u043a.             &lt;\/th&gt;             &lt;th&gt;                 PHP::in_array()                 &lt;br&gt;\u0441\u0435\u043a.             &lt;\/th&gt;                         &lt;th&gt;                 BinarySearch()-&gt;search()                 &lt;br&gt;\u0441\u0435\u043a.             &lt;\/th&gt;                     &lt;\/tr&gt;     &lt;\/thead&gt;     &lt;tbody&gt;         &lt;tr&gt;             &lt;td&gt;                 \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432             &lt;\/td&gt;             &lt;td&gt;&lt;?=$search_100?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_100_in_array?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_100_second?&gt;&lt;\/td&gt;                        &lt;\/tr&gt;           &lt;tr&gt;             &lt;td&gt;                 \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 1000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432             &lt;\/td&gt;             &lt;td&gt;&lt;?=$search_1000?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_1000_in_array?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_1000_second?&gt;&lt;\/td&gt;                       &lt;\/tr&gt;           &lt;tr&gt;             &lt;td&gt;                 \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 10000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432             &lt;\/td&gt;             &lt;td&gt;&lt;?=$search_10000?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_10000_in_array?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_10000_second?&gt;&lt;\/td&gt;                      &lt;\/tr&gt;           &lt;tr&gt;             &lt;td&gt;                 \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 100000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432             &lt;\/td&gt;             &lt;td&gt;&lt;?=$search_100000?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_100000_in_array?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_100000_second?&gt;&lt;\/td&gt;                        &lt;\/tr&gt;           &lt;tr&gt;             &lt;td&gt;                 \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 1000000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432             &lt;\/td&gt;             &lt;td&gt;&lt;?=$search_1000000?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_1000000_in_array?&gt;&lt;\/td&gt;             &lt;td&gt;&lt;?=$search_1000000_second?&gt;&lt;\/td&gt;                        &lt;\/tr&gt;              &lt;\/tbody&gt;     &lt;\/table&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <b>\u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430, \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b<\/b>  <\/p>\n<table>\n<thead>\n<tr>\n<th>   <\/th>\n<th> <b>PHP::sort()<\/b><br \/>   \u0441\u0435\u043a.   <\/th>\n<th> <b>BubbleSort()-&gt;sort()<\/b><br \/>   \u0441\u0435\u043a.   <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td> \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432   <\/td>\n<td>0.0000<\/td>\n<td>0.0023<\/td>\n<\/tr>\n<tr>\n<td> \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 1000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432   <\/td>\n<td>0.0002<\/td>\n<td>0.2305<\/td>\n<\/tr>\n<tr>\n<td> \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 10000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432   <\/td>\n<td>0.0031<\/td>\n<td>23.1601<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>  <b>\u041f\u043e\u0438\u0441\u043a \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b<\/b>  <\/p>\n<table>\n<thead>\n<tr>\n<th>   <\/th>\n<th> <b>PHP::array_search()<\/b><br \/>   \u0441\u0435\u043a.   <\/th>\n<th> <b>PHP::in_array()<\/b><br \/>   \u0441\u0435\u043a.   <\/th>\n<th> <b>BinarySearch()-&gt;search()<\/b><br \/>   \u0441\u0435\u043a.   <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td> \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432   <\/td>\n<td>0.000012<\/td>\n<td>0.000004<\/td>\n<td>0.000032<\/td>\n<\/tr>\n<tr>\n<td> \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 1000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432   <\/td>\n<td>0.000003<\/td>\n<td>0.000003<\/td>\n<td>0.000026<\/td>\n<\/tr>\n<tr>\n<td> \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 10000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432   <\/td>\n<td>0.000004<\/td>\n<td>0.000003<\/td>\n<td>0.000034<\/td>\n<\/tr>\n<tr>\n<td> \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 100000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432   <\/td>\n<td>0.000005<\/td>\n<td>0.000003<\/td>\n<td>0.000046<\/td>\n<\/tr>\n<tr>\n<td> \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 1000000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432   <\/td>\n<td>0.000003<\/td>\n<td>0.000003<\/td>\n<td>0.000005<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>  <b>\u0412\u044b\u0432\u043e\u0434\u044b<\/b> \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:   <\/p>\n<ul>\n<li>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0432 PHP \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0430 \u0442\u0440\u0438-\u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435, \u043d\u0435\u0436\u0435\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u0440\u043e\u043c. \u0418 \u044d\u0442\u043e \u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u0445 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f). <\/li>\n<li>\u0411\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a\u0430, \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435, \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043c\u0435\u043d\u044c\u0448\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (\u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u043d\u0438\u044e \u0441 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u0432 \u044f\u0437\u044b\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438). \u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043c\u043e\u0432 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u043b\u043e\u0435 \u0432\u043b\u0438\u044f\u043d\u0438\u0435.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0411\u0443\u0434\u0443 \u0440\u0430\u0434, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044b, \u043c\u044b\u0441\u043b\u0438 \u0438 \u0438\u0434\u0435\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u043b\u044e\u0434\u044f\u043c \u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0443\u0436\u0430\u0442 \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439.<br \/>  \u041f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0448\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u044d\u0442\u0430\u043f\u044b \u0432\u0437\u0440\u043e\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u044b. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e\u0447\u0442\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442\u0441\u043a\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442 \u043f\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e.<br \/>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u044b\u043b\u043e\u0436\u0435\u043d \u043d\u0430 GitHub: <a href=\"https:\/\/github.com\/volmir\/sort-search\">https:\/\/github.com\/volmir\/sort-search<\/a><br \/>  \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0432\u044b\u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0432\u0430\u0448\u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/324792\/\"> https:\/\/habrahabr.ru\/post\/324792\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0425\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0443\u0437\u044b\u0440\u044c\u043a\u043e\u0432\u043e\u0439 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430. \u041f\u0440\u043e\u0435\u043a\u0442 \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0443\u0447\u0435\u0431\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445. <br \/>  \u041a\u043e\u0433\u0434\u0430 \u043c\u0435\u043d\u044f \u0440\u0430\u043d\u044c\u0448\u0435 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u043b\u0438 \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u043e\u0431 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u044f \u0442\u0435\u0440\u044f\u043b\u0441\u044f \u0438 \u0441\u0447\u0438\u0442\u0430\u043b, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439 \u043d\u0430\u0434\u043e \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0442\u0430\u043b\u0430\u043d\u0442\u043b\u0438\u0432\u044b\u043c \u043e\u0442\u043b\u0438\u0447\u043d\u0438\u043a\u043e\u043c-\u043e\u043b\u0438\u043c\u043f\u0438\u0430\u0434\u043d\u0438\u043a\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e-\u0434\u043e\u043b\u0433\u043e-\u043c\u0430\u043b\u043e\u0438\u0437\u0443\u0447\u0435\u043d\u043e \u0438 \u0442.\u043f. \ud83d\ude42 \u0422\u0430\u043a \u0436\u0435 \u044f \u043d\u0430\u0445\u043e\u0434\u0438\u043b \u043a\u0443\u0440\u0441\u044b, \u0433\u0434\u0435 \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0434\u0435\u043b\u044c (\u043c\u0435\u0441\u044f\u0446\u0435\u0432) \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0432\u0441\u0435\u043c\u0443-\u0432\u0441\u0435\u043c\u0443 \u043f\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c, \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430\u043c, \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u041d\u043e \u0432\u0435\u0434\u044c \u0441\u0435\u0439\u0447\u0430\u0441 \u0435\u0441\u0442\u044c \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0430 \u0432 \u043d\u0435\u043c \u0443\u0436\u0435 \u0432\u0441\u0435 \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u043e \u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e? \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0438 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f.<br \/>  \u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0430\u043c\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (PHPUnit) \u0438 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 (\u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0437\u044b\u043a\u0430 VS \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434).<br \/>  \u0422.\u0435. \u043a\u0430\u043a \u0431\u044b \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0435\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438) \u0438 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u0432\u0441\u0435\u043c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u044d\u0442\u0430\u043f\u0430\u043c (\u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043d\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u00ab\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432\u00bb \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438).<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a73\/8f8\/2ef\/a738f82ef2a84b3995ab9e52240128dd.jpg\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-283866","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283866","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=283866"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283866\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}