{"id":620,"date":"2020-05-23T12:22:38","date_gmt":"2020-05-23T09:22:38","guid":{"rendered":"https:\/\/ek.oa.edu.ua\/Kukhta\/test3\/?p=620"},"modified":"2020-05-23T12:22:38","modified_gmt":"2020-05-23T09:22:38","slug":"vlastyvosti-ta-funktsii","status":"publish","type":"post","link":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/vlastyvosti-ta-funktsii\/","title":{"rendered":"\u0412\u043b\u0430\u0441\u0442\u0438\u0432\u043e\u0441\u0442\u0456 \u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0456\u0457"},"content":{"rendered":"<p>\u0417\u043c\u0456\u043d\u043d\u0456 \u0432 \u043a\u043b\u0430\u0441\u0456 \u043d\u0430\u0437\u0438\u0432\u0430\u044e\u0442\u044c\u0441\u044f &#8220;\u0432\u043b\u0430\u0441\u0442\u0438\u0432\u043e\u0441\u0442\u044f\u043c\u0438&#8221;. \u0422\u0430\u043a\u043e\u0436 \u0457\u0445 \u043d\u0430\u0437\u0438\u0432\u0430\u044e\u0442\u044c, \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0447\u0438 \u0456\u043d\u0448\u0456 \u0442\u0435\u0440\u043c\u0456\u043d\u0438, \u0442\u0430\u043a\u0456 \u044f\u043a &#8220;\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0438&#8221; \u0430\u0431\u043e &#8220;\u043f\u043e\u043b\u044f&#8221;. \u0412\u043e\u043d\u0438 \u0432\u0438\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u044c\u0441\u044f \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043a\u043b\u044e\u0447\u043e\u0432\u0438\u0445 \u0441\u043b\u0456\u0432 public, protected, \u0430\u0431\u043e private, \u0434\u043e\u0442\u0440\u0438\u043c\u0443\u044e\u0447\u0438\u0441\u044c \u043f\u0440\u0430\u0432\u0438\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0443 \u0437\u043c\u0456\u043d\u043d\u0438\u0445.<\/p>\n<p>\u041f\u0440\u0438\u043a\u043b\u0430\u0434 \u0432\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u0432\u043b\u0430\u0441\u0442\u0438\u0432\u043e\u0441\u0442\u0435\u0439.<\/p>\n<pre class=\"prettyprint linenums\">&lt;?php\r\nclass FirstClass {\r\n\u00a0 \u00a0 \u00a0public $var1 = \"hello\";\r\n\u00a0 \u00a0 \u00a0private $var2 = 25;\r\n\u00a0 \u00a0 \u00a0protected $var3 = [\"one\", \"two\"];\r\n}\r\n?&gt;<\/pre>\n<p>\u041a\u043b\u044e\u0447\u043e\u0432\u0456 \u0441\u043b\u043e\u0432\u0430 public, protected, private &#8211;\u00a0 \u0446\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0456 (\u0431\u0443\u0434\u0435 \u0440\u043e\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u043e \u0432 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u043e\u043c\u0443 \u0443\u0440\u043e\u0446\u0456).<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0456\u044f \u0432 \u043a\u043b\u0430\u0441\u0430\u0445 \u043d\u0430\u0437\u0438\u0432\u0430\u0454\u0442\u044c\u0441\u044f &#8220;\u043c\u0435\u0442\u043e\u0434\u043e\u043c&#8221;. \u041f\u0440\u043e\u0446\u0435\u0441 \u043e\u043f\u0438\u0441\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 \u0432\u0456\u0434\u0431\u0443\u0432\u0430\u0454\u0442\u044c\u0441\u044f \u044f\u043a \u043f\u0440\u0438 \u043e\u043f\u0438\u0441\u0456 \u0437\u0432\u0438\u0447\u0430\u0439\u043d\u043e\u0457 \u0444\u0443\u043d\u043a\u0446\u0456\u0457. \u041d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434:<\/p>\n<pre class=\"prettyprint linenums\">&lt;?php\r\nclass FirstClass {\r\n\r\n\u00a0 \u00a0 \u00a0public function firstFunction() {\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 $a = 25;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 $b = 35;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return $a + $b;\r\n\u00a0 \u00a0 \u00a0}\r\n}\r\n?&gt;<\/pre>\n<p>\u0423 \u043c\u0435\u0436\u0430\u0445 \u043c\u0435\u0442\u043e\u0434\u0456\u0432 \u043a\u043b\u0430\u0441\u0443 \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u043e \u0432\u043b\u0430\u0441\u0442\u0438\u0432\u043e\u0441\u0442\u0435\u0439 \u043c\u043e\u0436\u0435 \u0431\u0443\u0442\u0438 \u043e\u0442\u0440\u0438\u043c\u0430\u043d\u0438\u0439 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e -&gt; (\u043e\u0431&#8217;\u0454\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430) \u0456 \u043f\u043e\u043a\u0430\u0436\u0447\u0438\u043a\u0430 $this, \u043d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434 $this-&gt;var1 (\u0434\u0435 var1 \u2013 \u0456\u043c&#8217;\u044f \u0437\u043c\u0456\u043d\u043d\u043e\u0457) \u0430\u0431\u043e $this-&gt;firstFunction () (\u0434\u0435, firstFunction \u2013 \u0456\u043c&#8217;\u044f \u043c\u0435\u0442\u043e\u0434\u0443).<\/p>\n<p>\u041f\u0440\u0438\u043a\u043b\u0430\u0434:<\/p>\n<pre class=\"prettyprint linenums\">&lt;?php\r\nclass FirstClass {\r\n\u00a0 \u00a0 \u00a0private $var1;\r\n\r\n\u00a0 \u00a0 \u00a0public function setVar1($value) {\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 $this-&gt;var1 = $value;\r\n\u00a0 \u00a0 \u00a0}\r\n}\r\n\r\n<span class=\"hljs-variable\">$instance<\/span> = <span class=\"hljs-keyword\">new<\/span> FirstClass();\r\n\r\n<span class=\"hljs-variable\">$instance<\/span>-&gt;setVar1(<span class=\"hljs-string\">\"orange\"<\/span>); <span class=\"hljs-comment\">\/\/\u0432\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \"orange\" \u0434\u043b\u044f \u0437\u043c\u0456\u043d\u043d\u043e\u0457 var1\r\n<\/span><span class=\"hljs-preprocessor\">?&gt;<\/span><\/pre>\n<h3>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0438<\/h3>\n<p>\u0412\u0456\u0434\u043c\u0456\u043d\u043d\u0456\u0441\u0442\u044c \u0437\u043c\u0456\u043d\u043d\u0438\u0445 \u0456 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u043f\u043e\u043b\u044f\u0433\u0430\u0454 \u0432 \u0442\u043e\u043c\u0443, \u0449\u043e \u043f\u0440\u0438 \u043e\u0433\u043e\u043b\u043e\u0448\u0435\u043d\u043d\u0456 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u0430\u0431\u043e \u043f\u0440\u0438 \u0437\u0432\u0435\u0440\u043d\u0435\u043d\u043d\u0456 \u0434\u043e \u043d\u0438\u0445 \u043d\u0435 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u0442\u044c\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b $.<\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u043c\u0430\u0454 \u0431\u0443\u0442\u0438 \u043d\u0435\u0437\u043c\u0456\u043d\u043d\u0438\u043c \u0432\u0438\u0440\u0430\u0437\u043e\u043c, \u043d\u0435 \u0432\u043b\u0430\u0441\u0442\u0438\u0432\u0456\u0441\u0442\u044e, \u0430\u0431\u043e \u0432\u0438\u043a\u043b\u0438\u043a\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0456\u0457.<\/p>\n<p>\u041f\u043e\u0447\u0438\u043d\u0430\u044e\u0447\u0438 \u0437 \u0432\u0435\u0440\u0441\u0456\u0457 PHP 5.6, \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u0456 \u043e\u043f\u0435\u0440\u0430\u0446\u0456\u0457 \u0434\u043b\u044f \u0432\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442<\/p>\n<p>\u041e\u0433\u043e\u043b\u043e\u0448\u0435\u043d\u043d\u044f \u0442\u0430 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u0430\u043d\u043d\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0438:<\/p>\n<pre class=\"prettyprint linenums\">&lt;?php\r\nclass FirstClass {\r\n\u00a0 \u00a0 \u00a0const CONSTANT = \"value\";\r\n\u00a0 \u00a0 \u00a0const CONSTANT2 = 80 * 2 + 40; \/\/ &gt;= PHP 5.6\r\n}\r\n\r\n\/\/ \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0438\r\necho FirstClass:: CONSTANT;\r\n\r\n\/\/ \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 \u0432 \u043a\u043b\u0430\u0441\u0456\r\nclass FirstClass {\r\n\u00a0 \u00a0 \u00a0const CONSTANT = \"orange\";\r\n\r\n\u00a0 \u00a0 \u00a0function myFunc() {\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 echo self::CONSTANT;\r\n\u00a0 \u00a0 \u00a0}\r\n}\r\n<span class=\"hljs-preprocessor\">?&gt;<\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u043c\u0456\u043d\u043d\u0456 \u0432 \u043a\u043b\u0430\u0441\u0456 \u043d\u0430\u0437\u0438\u0432\u0430\u044e\u0442\u044c\u0441\u044f &#8220;\u0432\u043b\u0430\u0441\u0442\u0438\u0432\u043e\u0441\u0442\u044f\u043c\u0438&#8221;. \u0422\u0430\u043a\u043e\u0436 \u0457\u0445 \u043d\u0430\u0437\u0438\u0432\u0430\u044e\u0442\u044c, \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0447\u0438 \u0456\u043d\u0448\u0456 \u0442\u0435\u0440\u043c\u0456\u043d\u0438, \u0442\u0430\u043a\u0456 \u044f\u043a &#8220;\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0438&#8221; \u0430\u0431\u043e &#8220;\u043f\u043e\u043b\u044f&#8221;. \u0412\u043e\u043d\u0438 \u0432\u0438\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u044c\u0441\u044f \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043a\u043b\u044e\u0447\u043e\u0432\u0438\u0445 \u0441\u043b\u0456\u0432 public, protected, \u0430\u0431\u043e private, \u0434\u043e\u0442\u0440\u0438\u043c\u0443\u044e\u0447\u0438\u0441\u044c \u043f\u0440\u0430\u0432\u0438\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0443 \u0437\u043c\u0456\u043d\u043d\u0438\u0445. \u041f\u0440\u0438\u043a\u043b\u0430\u0434 \u0432\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u0432\u043b\u0430\u0441\u0442\u0438\u0432\u043e\u0441\u0442\u0435\u0439. &lt;?php class FirstClass { \u00a0 \u00a0 \u00a0public $var1 = &#8220;hello&#8221;; \u00a0 \u00a0 \u00a0private $var2 = 25; \u00a0 \u00a0 \u00a0protected $var3 = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-620","post","type-post","status-publish","format-standard","hentry","category-oop"],"_links":{"self":[{"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/posts\/620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/comments?post=620"}],"version-history":[{"count":1,"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/posts\/620\/revisions"}],"predecessor-version":[{"id":621,"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/posts\/620\/revisions\/621"}],"wp:attachment":[{"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/media?parent=620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/categories?post=620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ithub.oa.edu.ua\/webdev\/php\/wp-json\/wp\/v2\/tags?post=620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}