{"id":6702,"date":"2021-07-09T12:19:39","date_gmt":"2021-07-09T12:19:39","guid":{"rendered":"https:\/\/www.scmgalaxy.com\/tutorials\/?p=6702"},"modified":"2022-04-13T16:30:48","modified_gmt":"2022-04-13T16:30:48","slug":"advance-php","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/","title":{"rendered":"Advance PHP"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">What was easy in any language was made core and what became difficult was made an advance. What happens in Core is of basic level and what happens in Advance is of upper-level.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Object Oriented Progrmming<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Object-Oriented Programming is a Technic that solves the problem. In this, the code breaks the object. And you see your problem on the side of the object. In which you find your problem similar to the real-world problem and it is easy to maintain, and it has to be solved.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Class<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The PHP class has a group of values. To manipulate whatever value you write inside the class, you also write operations in it. The class gives you this facility, that if the user does not need to know the information. So you can also hide the information. To use the application, you can keep it hidden for security purposes. Or if it will be accessed from the outside users or from an outside viewer then your application may be damaged. That&#8217;s why you can keep your application hidden, it gives class facility. You can define type using class.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Rule<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>The class name can be any valid label.<\/li><li>It can&#8217;t be PHP reserved world.<\/li><li>The class name must start with a letter or an underscore. Following by any number of letters, numbers, or underscore all this will work. Lwkin should not start with number.<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nclass Classname\n{\n\tvar $variable_name;  (It is also called Data Member\/Properties or Attribute.)\n\tvar $variable_name;\n\t\n\tfunction Method_name()\n\t{\n\t\tBody of method;\n\t}\n\tfunction Method_name(parameter_list)     (And these methods are called methods or member functions.)\n\t{\n\t\tBody of Method;\n\t}\n\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>See your problem in the real world.<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nclass Mobile\n{\n\tpublic $model;\n\tfunction show Model (Sumber)\n\t{\n\t\t$this-&gt;model = $number;\n\t\techo &quot;Model Number: $this-&gt;model&quot;;\n\t}\n\t\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Object<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The object is a variable of class data type. Whenever you create an object, for that object, whatever is proper inside the class, a copy of it is prepared and it is prepared for that object. If there are 2 objects then 2 copies of that variable or that property will be created and one copy for the first object and a second copy for the second object. Whatever object you make, its copy will be ready and one copy will be distributed. But this is not the case with the member function. The member function is the same, all the objects share with it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The new Operator is used to create an object.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Syntax:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nclass Mobile\n{\n\tpublic $model;\n\tfunction show Model (Sumber)\n\t{\n\t\t$this-&gt;model = $number;\n\t\techo &quot;Model Number: $this-&gt;model&quot;;\n\t}\n\t\n}\n$samsung = new Mobile;\n$samsung-&gt;showModel(&#039;A5&#039;);\n\n$lg = new Mobile;\n$lg-&gt;showModel(&#039;M30&#039;);\n\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">You will not need to write the class, again and again, you just have to create an object of it. And call this method with the help of that object. It will show its own model number.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Important thing<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A class is of no importance unless it has an object.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Accessing class member using object<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">How would you make accessing a member of a class into a user object?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">-&gt; This operator is used to access the member of the class.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">object_name-&gt;variable_name;<br>$samsung-&gt;model;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">access to method<br>Object_name-&gt;method_name();<br>$samsung-&gt;showModel();<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">in parameter<br>Object_name-&gt;method_name(parameter_list)<br>$samsung-&gt;showModel(&#8216;A8&#8217;);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What was easy in any language was made core and what became difficult was made an advance. What happens in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5388],"tags":[5144,4240,5137,177,317],"class_list":["post-6702","post","type-post","status-publish","format-standard","hentry","category-php","tag-functions","tag-method","tag-objects","tag-php","tag-variables"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Advance PHP - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Advance PHP - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"What was easy in any language was made core and what became difficult was made an advance. What happens in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-09T12:19:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-13T16:30:48+00:00\" \/>\n<meta name=\"author\" content=\"rajeshkumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rajeshkumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/advance-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/advance-php\\\/\"},\"author\":{\"name\":\"rajeshkumar\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"headline\":\"Advance PHP\",\"datePublished\":\"2021-07-09T12:19:39+00:00\",\"dateModified\":\"2022-04-13T16:30:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/advance-php\\\/\"},\"wordCount\":467,\"commentCount\":0,\"keywords\":[\"functions\",\"Method\",\"objects\",\"Php\",\"Variables\"],\"articleSection\":[\"php\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/advance-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/advance-php\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/advance-php\\\/\",\"name\":\"Advance PHP - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2021-07-09T12:19:39+00:00\",\"dateModified\":\"2022-04-13T16:30:48+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/advance-php\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/advance-php\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/advance-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Advance PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\",\"name\":\"rajeshkumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"caption\":\"rajeshkumar\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/rajeshkumar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Advance PHP - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/","og_locale":"en_US","og_type":"article","og_title":"Advance PHP - scmGalaxy","og_description":"What was easy in any language was made core and what became difficult was made an advance. What happens in [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/","og_site_name":"scmGalaxy","article_published_time":"2021-07-09T12:19:39+00:00","article_modified_time":"2022-04-13T16:30:48+00:00","author":"rajeshkumar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rajeshkumar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/"},"author":{"name":"rajeshkumar","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"headline":"Advance PHP","datePublished":"2021-07-09T12:19:39+00:00","dateModified":"2022-04-13T16:30:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/"},"wordCount":467,"commentCount":0,"keywords":["functions","Method","objects","Php","Variables"],"articleSection":["php"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/","name":"Advance PHP - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2021-07-09T12:19:39+00:00","dateModified":"2022-04-13T16:30:48+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/advance-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Advance PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361","name":"rajeshkumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","caption":"rajeshkumar"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/rajeshkumar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=6702"}],"version-history":[{"count":2,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6702\/revisions"}],"predecessor-version":[{"id":6713,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6702\/revisions\/6713"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=6702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=6702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=6702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}