{"id":2722,"date":"2021-07-20T10:02:00","date_gmt":"2021-07-20T10:02:00","guid":{"rendered":"https:\/\/www.bearloga.space\/?page_id=2722"},"modified":"2021-07-20T10:02:01","modified_gmt":"2021-07-20T10:02:01","slug":"trejty","status":"publish","type":"page","link":"https:\/\/www.bearloga.space\/uk\/trejty\/","title":{"rendered":"\u0422\u0440\u0435\u0439\u0442\u044b"},"content":{"rendered":"\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 5.4.0 \u0432 PHP \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430. \u041e\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u2014&nbsp;<strong>\u0442\u0440\u0435\u0439\u0442<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0440\u0435\u0439\u0442 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u043a\u043b\u0430\u0441\u0441, \u043d\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0442\u0440\u0435\u0439\u0442\u0430. \u042d\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n<strong>trait<\/strong> MyTrait {\n\t<strong>public<\/strong> <strong>function<\/strong> <strong>myFunc<\/strong>() {\n\t\t<strong>return<\/strong> 2 + 2;\n\t}\n}\n?&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0439\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f &#8220;\u0422\u0440\u0430\u043d\u0441\u043b\u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430&#8221; (\u0441\u0443\u0442\u044c: \u0431\u0443\u043a\u0432\u044b \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u044b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432 \u043b\u0430\u0442\u0438\u043d\u0438\u0446\u0443).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n<strong>trait<\/strong> MyTransliterator {\n\t<strong>private<\/strong> $letters = <strong>array<\/strong>(\n        '\u0430' =&gt; 'a',   \t'\u0431' =&gt; 'b',     '\u0432' =&gt; 'v',\n        '\u0433' =&gt; 'g',   \t'\u0434' =&gt; 'd',   \t'\u0435' =&gt; 'e',\n        '\u0451' =&gt; 'e',   \t'\u0436' =&gt; 'zh',  \t'\u0437' =&gt; 'z',\n        '\u0438' =&gt; 'i',   \t'\u0439' =&gt; 'y',   \t'\u043a' =&gt; 'k',\n        '\u043b' =&gt; 'l',   \t'\u043c' =&gt; 'm',   \t'\u043d' =&gt; 'n',\n        '\u043e' =&gt; 'o',   \t'\u043f' =&gt; 'p',   \t'\u0440' =&gt; 'r',\n        '\u0441' =&gt; 's',   \t'\u0442' =&gt; 't',   \t'\u0443' =&gt; 'u',\n        '\u0444' =&gt; 'f',   \t'\u0445' =&gt; 'h',   \t'\u0446' =&gt; 'c',\n        '\u0447' =&gt; 'ch',  \t'\u0448' =&gt; 'sh',  \t'\u0449' =&gt; 'sch',\n        '\u044c' =&gt; '',   \t'\u044b' =&gt; 'y',   \t'\u044a' =&gt; '',\n        '\u044d' =&gt; 'e',   \t'\u044e' =&gt; 'yu',  \t'\u044f' =&gt; 'ya',\n        '\u0410' =&gt; 'A',   \t'\u0411' =&gt; 'B',   \t'\u0412' =&gt; 'V',\n        '\u0413' =&gt; 'G',   \t'\u0414' =&gt; 'D',   \t'\u0415' =&gt; 'E',\n        '\u0401' =&gt; 'E',   \t'\u0416' =&gt; 'Zh',  \t'\u0417' =&gt; 'Z',\n        '\u0418' =&gt; 'I',   \t'\u0419' =&gt; 'Y',   \t'\u041a' =&gt; 'K',\n        '\u041b' =&gt; 'L',   \t'\u041c' =&gt; 'M',   \t'\u041d' =&gt; 'N',\n        '\u041e' =&gt; 'O',   \t'\u041f' =&gt; 'P',   \t'\u0420' =&gt; 'R',\n        '\u0421' =&gt; 'S',   \t'\u0422' =&gt; 'T',   \t'\u0423' =&gt; 'U',\n        '\u0424' =&gt; 'F',   \t'\u0425' =&gt; 'H',   \t'\u0426' =&gt; 'C',\n        '\u0427' =&gt; 'Ch',  \t'\u0428' =&gt; 'Sh',  \t'\u0429' =&gt; 'Sch',\n        '\u042c' =&gt; '',  \t'\u042b' =&gt; 'Y',   \t'\u042a' =&gt; '_',\n        '\u042d' =&gt; 'E',   \t'\u042e' =&gt; 'Yu',  \t'\u042f' =&gt; 'Ya',\n        '\u0454' =&gt; 'ye', \t'\u0457' =&gt; 'yi', \t'\u0456' =&gt; 'i',\n        '\u0404' =&gt; 'YE', \t'\u0407' =&gt; 'YI', \t'\u0406' =&gt; 'I',\n        ' ' =&gt; '_'\n    );\n\n\t<strong>public<\/strong> <strong>function<\/strong> <strong>translate<\/strong>($str) {\n\t\t\/\/ \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u044b \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043b\u0430\u0442\u0438\u043d\u0438\u0446\u044b\n\t\t<strong>return<\/strong> strtr(trim($str), <strong>$this<\/strong>-&gt;letters);\n\t}\n}\n\n<strong>class<\/strong> <strong>MyClass<\/strong> {\n\t<strong>use<\/strong> <strong>MyTransliterator<\/strong>;\n\t\n\t<strong>private<\/strong> $data;\n\t\n\t\/**\n\t*\t\u041d\u0435\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0430\u0448 \u043c\u0430\u0441\u0441\u0438\u0432 \n\t*\/\n\t<strong>public<\/strong> <strong>function<\/strong> <strong>setData<\/strong>(<strong>array<\/strong> $data) {\n\t\t<strong>$this<\/strong>-&gt;data = $data;\n\t}\n\t\n\t\/**\n\t*\t \u041d\u0435\u043a\u0430\u044f \u0444\u0443\u043a\u043d\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445\n\t*\/\n\t<strong>public<\/strong> <strong>function<\/strong> <strong>getPreparedData<\/strong>() {\n\t\t\/\/ \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e\n\t\t\/\/ \u0442\u043e\u0433\u0434\u0430, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441 \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 \u043d\u0430 \u043b\u0430\u0442\u0438\u043d\u0438\u0446\u0443\n\t\t<strong>$this<\/strong>-&gt;data&#91;'url'] = strtolower(<strong>$this<\/strong>-&gt;translate(<strong>$this<\/strong>-&gt;data&#91;'title']));\n\t\t\n\t\t<strong>return<\/strong> <strong>$this<\/strong>-&gt;data;\n\t}\n}\n\n$obj = <strong>new<\/strong> MyClass;\n\n$obj-&gt;setData(&#91;\n\t'title' =&gt; '\u041d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b',\n\t'content' =&gt; '\u0422\u0435\u043a\u0441\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b'\n]);\n\n$data = $obj-&gt;getPreparedData();\n\n<strong>echo<\/strong> \"&lt;pre&gt;\";\nprint_r($data);\n<strong>echo<\/strong> \"&lt;\/pre&gt;\";\n?&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Array\n(\n    &#91;title] =&gt; \u041d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b\n    &#91;content] =&gt; \u0422\u0435\u043a\u0441\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b\n    &#91;url] =&gt; ne_ochen_prostoe_nazvanie_dlya_stranicy\n)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 5.4.0 \u0432 PHP \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430. \u041e\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u2014&nbsp;\u0442\u0440\u0435\u0439\u0442. \u0422\u0440\u0435\u0439\u0442 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[100],"tags":[],"class_list":["post-2722","page","type-page","status-publish","hentry","category-onlajn-uchebnik-po-php"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/2722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/comments?post=2722"}],"version-history":[{"count":0,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/2722\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/media?parent=2722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/categories?post=2722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/tags?post=2722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}