{"id":1579,"date":"2016-10-05T22:05:55","date_gmt":"2016-10-05T20:05:55","guid":{"rendered":"http:\/\/netspider.com.ua\/?p=1579"},"modified":"2016-10-08T09:09:07","modified_gmt":"2016-10-08T07:09:07","slug":"php-and-bitwise-shift","status":"publish","type":"post","link":"https:\/\/netspider.com.ua\/index.php\/2016\/10\/05\/php-and-bitwise-shift\/","title":{"rendered":"PHP \u0438 \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u0439 \u0441\u0434\u0432\u0438\u0433"},"content":{"rendered":"<p>PHP, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u044f\u0437\u044b\u043a \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0421 \u0438\u043b\u0438 \u0421++. \u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u043f\u0438\u0445\u0430\u0435\u0442\u0435 \u0432 \u043d\u0435\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0441\u0430\u043c \u0440\u0435\u0448\u0430\u0435\u0442, \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u0438\u0445 \u0445\u0440\u0430\u043d\u0438\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u2013 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432.<\/p>  <p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0435\u0435 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0438\u043f. \u0412 PHP \u043d\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0447\u0438\u0441\u0435\u043b (uint, unsigned integer) \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043c\u0435\u0449\u0435\u043d \u0432 float (double).<\/p>  <p>\u041d\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0434\u0432\u0438\u0433\u0430 (bitwise shift) \u0432\u043b\u0435\u0432\u043e (&lt;&lt;) \u043c\u044b \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0439\u0442\u0438 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b integer \u0438 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430:<\/p><!--more--><pre class=\"brush: php; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;\">&lt;?php\n$p = 1818396875;\n$q = $p;\necho &quot;\\n\\n\\n\\$p = (&quot; . gettype($p) . &quot;) $p\\n&quot;;\necho &quot;Executing \\$p = (float)\\$p;\\n&quot;;\n$p = (float)$p;\necho &quot;\\$p = (&quot; . gettype($p) . &quot;) $p\\n&quot;;\necho &quot;Binary value is: &quot; . decbin( $p ) . &quot;\\n&quot;;\necho &quot;Executing \\$p = \\$p &lt;&lt; 1;\\n&quot;;\n$p = $p &lt;&lt; 1;\necho &quot;\\$p = (&quot; . gettype($p) . &quot;) $p\\n&quot;;\necho &quot;Binary value is: &quot; . decbin( $p ) . &quot;\\n&quot;;\necho &quot;Converting \\$p via bindec( decbin( \\$p ) )\\n&quot;;\n$p = bindec( decbin( $p ) );\necho &quot;\\$p = (&quot; . gettype($p) . &quot;) $p\\n&quot;;\necho &quot;Binary value is: &quot; . decbin( $p ) . &quot;\\n\\n&quot;;\n\necho &quot;\\$q = (&quot; . gettype($q) . &quot;) $q\\n&quot;;\necho &quot;Binary value is: &quot; . decbin( $q ) . &quot;\\n&quot;;\necho &quot;Executing \\$q = \\$q * 2;\\n&quot;;\n$q = $q * 2;\necho &quot;\\$q = (&quot; . gettype($q) . &quot;) $q\\n&quot;;\necho &quot;Binary value is: &quot; . decbin( $q ) . &quot;\\n\\n\\n\\n&quot;;\n?&gt;<\/pre>\n\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n\n<pre class=\"brush: text; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;\">$p = (integer) 1818396875\nExecuting $p = (float)$p;\n$p = (double) 1818396875\nBinary value is: 1101100011000101000100011001011\nExecuting $p = $p &lt;&lt; 1;\n$p = (integer) -658173546\nBinary value is: 11011000110001010001000110010110\nConverting $p via bindec( decbin( $p ) )\n$p = (double) 3636793750\nBinary value is: 11011000110001010001000110010110\n\n$q = (integer) 1818396875\nBinary value is: 1101100011000101000100011001011\nExecuting $q = $q * 2;\n$q = (double) 3636793750\nBinary value is: 11011000110001010001000110010110<\/pre>\n\n<p><em>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0442\u0438\u043f\u0430 double.<\/em><\/p>\n\n<p>\u0423\u0432\u044b, \u044d\u0442\u043e \u043d\u0435 \u0431\u0430\u0433\u0430, \u0430 \u0444\u0438\u0447\u0430, \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e: \u201c\u041e\u0431\u0430 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <em>&lt;&lt;<\/em> \u0438 <em>&gt;&gt;<\/em> \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0437\u0430 \u0446\u0435\u043b\u043e\u0435.\u201d.<\/p>\n\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438.<\/p>","protected":false},"excerpt":{"rendered":"PHP, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u044f\u0437\u044b\u043a \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0421 \u0438\u043b\u0438 \u0421++. \u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u043f\u0438\u0445\u0430\u0435\u0442\u0435 \u0432 \u043d\u0435\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0441\u0430\u043c \u0440\u0435\u0448\u0430\u0435\u0442, \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u0438\u0445 \u0445\u0440\u0430\u043d\u0438\u0442\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u2013 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432. \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442\u2026 <span class=\"read-more\"><a href=\"https:\/\/netspider.com.ua\/index.php\/2016\/10\/05\/php-and-bitwise-shift\/\">\u0427\u0438\u0442\u0430\u0442\u0438 \u0434\u0430\u043b\u0456 &raquo;<\/a><\/span>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1832,1833,1698,1445,665],"class_list":["post-1579","post","type-post","status-publish","format-standard","hentry","category-main","tag-binary","tag-bitwise-shift","tag-bug","tag-bugs","tag-php"],"_links":{"self":[{"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/posts\/1579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/comments?post=1579"}],"version-history":[{"count":2,"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/posts\/1579\/revisions"}],"predecessor-version":[{"id":1581,"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/posts\/1579\/revisions\/1581"}],"wp:attachment":[{"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/media?parent=1579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/categories?post=1579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netspider.com.ua\/index.php\/wp-json\/wp\/v2\/tags?post=1579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}