{"id":741,"date":"2017-02-23T15:43:26","date_gmt":"2017-02-23T23:43:26","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=741"},"modified":"2017-02-23T15:43:26","modified_gmt":"2017-02-23T23:43:26","slug":"advanced-features-of-php","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=741","title":{"rendered":"Advanced Features of PHP"},"content":{"rendered":"<p><strong>1) Late Static Binding: <\/strong><br \/>\n&#8220;Late binding&#8221; comes from the fact that static:: will not be resolved using the class where the method is defined but it will rather be computed using runtime information.<\/p>\n<pre>\r\nclass A {\r\n    public static function who() {\r\n        echo __CLASS__;\r\n    }\r\n    public static function test() {\r\n        self::who();\r\n    }\r\n}\r\n\r\nclass B extends A {\r\n    public static function who() {\r\n        echo __CLASS__;\r\n    }\r\n}\r\n\r\nB::test();\r\n<\/pre>\n<p>Instead of &#8220;self::who()&#8221; replace with &#8220;static::who()&#8221;. Then the output will be &#8220;B&#8221; instead of &#8220;A&#8221;. <\/p>\n<p><strong>2) Variable Length Argument Lists : <\/strong><\/p>\n<p>func_num_args() ==> returns number of arguments passed<br \/>\nfunc_get_arg(int) ==> returns the nth argument passed in<br \/>\nfunc_get_args() ==> returns an array of all arguments <\/p>\n","protected":false},"excerpt":{"rendered":"<p>1) Late Static Binding: &#8220;Late binding&#8221; comes from the fact that static:: will not be resolved using the class where the method is defined but it will rather be computed using runtime information. class A { public static function who() { echo __CLASS__; } public static function test() { self::who(); } } class B extends &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=741\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Advanced Features of PHP<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-741","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=741"}],"version-history":[{"count":1,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/741\/revisions"}],"predecessor-version":[{"id":742,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/741\/revisions\/742"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=741"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}