{"id":52,"date":"2008-02-06T21:32:40","date_gmt":"2008-02-06T21:32:40","guid":{"rendered":"http:\/\/www.badral.net\/?p=52"},"modified":"2008-02-06T21:32:40","modified_gmt":"2008-02-06T21:32:40","slug":"utf-8-substring-function","status":"publish","type":"post","link":"https:\/\/www.badral.net\/?p=52","title":{"rendered":"UTF-8 substring function"},"content":{"rendered":"<p>\u0421\u04af\u04af\u043b\u0438\u0439\u043d \u04af\u0435\u0434 \u044f\u043d\u0437 \u0431\u04af\u0440\u0438\u0439\u043d \u043c\u043e\u043d\u0433\u043e\u043b \u0432\u044d\u0431\u04af\u04af\u0434\u0438\u0439\u0433 \u0445\u0430\u0440\u0436 \u0431\u0430\u0439\u0445\u0430\u0434 \u044e\u043d\u0438\u043a\u043e\u0434 \u0431\u0438\u0447\u0432\u044d\u0440 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430\u0430\u0440 \u0442\u0430\u0441\u0430\u043b\u0436 \u0430\u0432\u0430\u0445\u0434\u0430\u0430 \u0448\u0443\u0443\u0434 PHP substr \u0444\u0443\u043d\u043a\u0446 \u0430\u0448\u0438\u0433\u043b\u0430\u0430\u0434 \u043d\u04e9\u0433\u04e9\u04e9\u0434\u04af\u04af\u043b \u043d\u044c \u044d\u0432\u0434\u044d\u0440\u0447 \u0445\u0430\u0440\u0430\u0433\u0434\u0430\u0445 \u043d\u044c \u0438\u0445 \u0431\u043e\u043b\u0436\u044d\u044d. \u0416\u0438\u0448\u044d\u044d\u043b\u0431\u044d\u043b computertimes.mn \u0434\u044d\u044d\u0440 <\/p>\n<blockquote><p>\n\u04e8\u043d\u04e9\u04e9\u0434\u04e9\u0440 \u0434\u044d\u043b\u0445\u0438\u0439\u043d \u043c\u044d\u0434\u044d\u044d\u043b\u043b\u0438\u0439\u043d \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438 (\u041c\u0422)-\u0438\u0439\u043d \u0437\u0430\u0445 \u0437\u044d\u044d\u043b \u0430\u0441\u0430\u0440 \u0445\u0443\u0440\u0434\u0430\u0446\u0442\u0430\u0439\u0433\u0430\u0430\u0440 \u0445\u04af\u0440\u044d\u044d\u0433\u044d\u044d \u0442\u044d\u043b\u0436 \u0443\u043b\u0430\u043c \u0431\u04af\u0440 \u0433\u043b\u043e\u0431\u0430\u043b \u0448\u0438\u043d\u0436\u0442\u044d\u0439 \u0431\u043e\u043b\u0436&#038;nbs ; \u0431\u0430\u0439\u043d\u0430. \u0414\u044d\u043b\u0445\u0438\u0439 \u0434\u044d\u044d\u0440 \u044d\u043d\u044d \u0441\u0430\u043b\u0431\u0430\u0440\u0442 \u0437\u0430\u0440\u0434\u0430\u0433 \u043c\u04e9\ufffd&#8230;\n<\/p><\/blockquote>\n<p>\u0421\u04af\u04af\u043b\u0438\u0439\u043d 3 \u0446\u044d\u0433\u0438\u0439\u043d \u04e9\u043c\u043d\u04e9 UTF-8 \u0442\u044d\u043c\u0434\u044d\u0433\u0442 \u044d\u0432\u0434\u044d\u0440\u0441\u044d\u043d \u0431\u0430\u0439\u0433\u0430\u0430\u0433 \u0442\u0430 \u0431\u04af\u0445\u044d\u043d \u0445\u0430\u0440\u0436 \u0431\u0430\u0439\u043d\u0430. \u0418\u0439\u043c\u044d\u0440\u0445\u04af\u04af \u0430\u0441\u0443\u0443\u0434\u043b\u0443\u0443\u0434\u044b\u0433 \u0437\u0430\u0441\u0430\u0445\u0430\u0434 \u0437\u043e\u0440\u0438\u0443\u043b\u0436 \u0431\u0438\u0447\u0441\u044d\u043d \u0434\u0430\u0440\u0430\u0430\u0445 \u0444\u0443\u043d\u043a\u0446\u044b\u0433 \u0442\u0430 \u0431\u04af\u0445\u044d\u043d\u0434 \u0442\u043e\u043b\u0438\u043b\u0443\u0443\u043b\u0436 \u0431\u0430\u0439\u043d\u0430.<\/p>\n<blockquote><p>\nfunction utf8_substr($str, $offset, $length= false) {<br \/>\n    preg_match_all(&#8216;~[\\x09\\x0A\\x0D\\x20-\\x7E]<br \/>\n                                 | [\\xC2-\\xDF][\\x80-\\xBF]<br \/>\n                                 |  \\xE0[\\xA0-\\xBF][\\x80-\\xBF]<br \/>\n                                 | [\\xE1-\\xEC\\xEE\\xEF][\\x80-\\xBF]{2}<br \/>\n                                 |  \\xED[\\x80-\\x9F][\\x80-\\xBF]<br \/>\n                                 |  \\xF0[\\x90-\\xBF][\\x80-\\xBF]{2}<br \/>\n                                 | [\\xF1-\\xF3][\\x80-\\xBF]{3}<br \/>\n                                 |  \\xF4[\\x80-\\x8F][\\x80-\\xBF]{2}<br \/>\n                                ~xs&#8217;, $str, $match);<br \/>\n    if ($length !== false) {<br \/>\n      $a= array_slice($match[0], $offset, $length);<br \/>\n    } else {<br \/>\n      $a= array_slice($match[0], $offset);<br \/>\n    }<br \/>\n    return implode(&#8221;, $a);<br \/>\n  }\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u04af\u04af\u043b\u0438\u0439\u043d \u04af\u0435\u0434 \u044f\u043d\u0437 \u0431\u04af\u0440\u0438\u0439\u043d \u043c\u043e\u043d\u0433\u043e\u043b \u0432\u044d\u0431\u04af\u04af\u0434\u0438\u0439\u0433 \u0445\u0430\u0440\u0436 \u0431\u0430\u0439\u0445\u0430\u0434 \u044e\u043d\u0438\u043a\u043e\u0434 \u0431\u0438\u0447\u0432\u044d\u0440 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430\u0430\u0440 \u0442\u0430\u0441\u0430\u043b\u0436 \u0430\u0432\u0430\u0445\u0434\u0430\u0430 \u0448\u0443\u0443\u0434 PHP substr \u0444\u0443\u043d\u043a\u0446 \u0430\u0448\u0438\u0433\u043b\u0430\u0430\u0434 \u043d\u04e9\u0433\u04e9\u04e9\u0434\u04af\u04af\u043b \u043d\u044c \u044d\u0432\u0434\u044d\u0440\u0447 \u0445\u0430\u0440\u0430\u0433\u0434\u0430\u0445 \u043d\u044c \u0438\u0445 \u0431\u043e\u043b\u0436\u044d\u044d. \u0416\u0438\u0448\u044d\u044d\u043b\u0431\u044d\u043b computertimes.mn \u0434\u044d\u044d\u0440 \u04e8\u043d\u04e9\u04e9\u0434\u04e9\u0440 \u0434\u044d\u043b\u0445\u0438\u0439\u043d \u043c\u044d\u0434\u044d\u044d\u043b\u043b\u0438\u0439\u043d \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438 (\u041c\u0422)-\u0438\u0439\u043d \u0437\u0430\u0445 \u0437\u044d\u044d\u043b \u0430\u0441\u0430\u0440 \u0445\u0443\u0440\u0434\u0430\u0446\u0442\u0430\u0439\u0433\u0430\u0430\u0440 \u0445\u04af\u0440\u044d\u044d\u0433\u044d\u044d \u0442\u044d\u043b\u0436 \u0443\u043b\u0430\u043c \u0431\u04af\u0440 \u0433\u043b\u043e\u0431\u0430\u043b \u0448\u0438\u043d\u0436\u0442\u044d\u0439 \u0431\u043e\u043b\u0436&#038;nbs ; \u0431\u0430\u0439\u043d\u0430. \u0414\u044d\u043b\u0445\u0438\u0439 \u0434\u044d\u044d\u0440 \u044d\u043d\u044d \u0441\u0430\u043b\u0431\u0430\u0440\u0442 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-52","post","type-post","status-publish","format-standard","hentry","category-8"],"_links":{"self":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts\/52","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=52"}],"version-history":[{"count":0,"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts\/52\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}