{"id":219272,"date":"2022-12-03T19:38:00","date_gmt":"2022-12-03T16:38:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=219272"},"modified":"2022-08-09T09:34:24","modified_gmt":"2022-08-09T06:34:24","slug":"razdelenie-strok-i-celyh-chisel-v-php","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/ru\/razdelenie-strok-i-celyh-chisel-v-php\/","title":{"rendered":"\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0438 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 PHP"},"content":{"rendered":"\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438, \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 PHP \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u043c.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u044f\u043c, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u044f\u0441\u043d\u043e, \u0438\u043b\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u044f\u0441\u043d\u043e, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u043e \u043d\u0435 \u0442\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e.<\/p>\n<p>\u0424\u043e\u0442\u043e \u0410\u0433\u0435 \u0411\u0430\u0440\u0440\u043e\u0441\u0430 \u043d\u0430 Unsplash<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430, \u0441\u043c\u0435\u0448\u0430\u043d\u043d\u0430\u044f \u043a\u0430\u043a \u0441 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u0442\u0430\u043a \u0438 \u0441 \u0446\u0438\u0444\u0440\u0430\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430:<\/p>\n<ul>\n<li>\u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0447\u0430\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0442\u044b,<\/li>\n<li>\u043a\u043e\u0433\u0434\u0430 \u043c\u0438\u043d\u0443\u0442\u044b \u043d\u0430 60,<\/li>\n<li>\u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u043e\u0432 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443<\/li>\n<li>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0438\u043d\u0443\u0442 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442\u0441\u044f.<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0444\u043e\u0440\u043c\u0443 T3H60M. \u041a\u0430\u043a \u0436\u0435 \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0435?<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0432\u0435\u0449\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0430\u0448\u0435\u043b \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438. \u0412 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435:<\/p>\n<ul>\n<li>\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/li>\n<li><a href=\"https:\/\/secure.php.net\/manual\/en\/function.preg-split.php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">preg_split<\/a><\/li>\n<li><a href=\"https:\/\/secure.php.net\/manual\/en\/function.array-filter.php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0444\u0438\u043b\u044c\u0442\u0440_\u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/a><\/li>\n<li><a href=\"https:\/\/secure.php.net\/manual\/en\/function.array-values.php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u043c\u0430\u0441\u0441\u0438\u0432_\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/a><\/li>\n<\/ul>\n<p>\u0418 \u043f\u043e\u0440\u044f\u0434\u043e\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439:<\/p>\n<ol>\n<li>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0446\u0438\u0444\u0440\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435,<\/li>\n<li>\u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435, \u043a\u0440\u043e\u043c\u0435 \u0446\u0438\u0444\u0440 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435<\/li>\n<li>\u0435\u0441\u043b\u0438 \u0432\u0442\u043e\u0440\u0430\u044f \u0446\u0438\u0444\u0440\u0430 60, \u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0435 \u0440\u0430\u0432\u043d\u043e\u0439 \u043d\u0443\u043b\u044e<\/li>\n<li>\u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443<\/li>\n<li>\u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443.<\/li>\n<\/ol>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0448\u0430\u0433\u0438 \u0431\u044b\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u043e\u0434, <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/4458820d452c5d144dc26fc6f6b5ac12#file-00-format-time-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u044d\u0442\u043e \u043c\u043e\u0433\u043b\u043e \u0431\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/a><\/strong><\/p>\n<pre><code>&lt;?php\n\n$totalTimeParts = array_values(\n  array_filter(\n    preg_split(\"\/(&lt;=[0-9])*([a-zA-Z])\/i\", $totalTime)) );\n\nif (isset($totalTimeParts[0]) &amp;&amp; isset($totalTimeParts[1]) &amp;&amp; '60' === $totalTimeParts[1]) {\n  $hours = (int)$totalTimeParts[0] + 1;\n  $minutes = '00';\n  $totalTime = \"P$hours\". 'H'. $minutes. 'M';\n}\n\nreturn $totalTime;<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/gist.github.com\/tommcfarlin\/4458820d452c5d144dc26fc6f6b5ac12\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">array_filter<\/a> \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/gist.github.com\/tommcfarlin\/4458820d452c5d144dc26fc6f6b5ac12\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">array_values<\/a> \u200b\u200b\u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432\u0441\u0435\u0433\u043e \u0434\u043e \u0434\u0432\u0443\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u043f\u0435\u0440\u0432\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u044d\u0442\u043e \u0447\u0430\u0441, \u0432\u0442\u043e\u0440\u0430\u044f \u2014 \u043c\u0438\u043d\u0443\u0442\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (\u0438 \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u044f \u0441\u043e\u0437\u0434\u0430\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e \u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 (\u0438 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e).<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0438\u0448\u0435\u0432\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u043c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0430\u0448\u0438\u0445 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0437\u0430\u043f\u0438\u0441\u0438:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/tommcfarlin.com\" class=\"external external_icon\">tommcfarlin.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 preg_split \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 PHP \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0438 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 PHP \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n","protected":false},"author":1,"featured_media":163201,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[809,900,726,850],"tags":[1171],"class_list":["post-219272","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-ru","category-kod-2","category-rozrobnyk-ru","category-uchebniki-ru","tag-affiai-ru"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/219272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/comments?post=219272"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/219272\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media\/163201"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media?parent=219272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/categories?post=219272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/tags?post=219272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}