{"id":109,"date":"2021-03-08T00:21:19","date_gmt":"2021-03-08T00:21:19","guid":{"rendered":"https:\/\/phptutorial.net\/?page_id=109"},"modified":"2025-04-07T11:32:19","modified_gmt":"2025-04-07T11:32:19","slug":"php-static-methods","status":"publish","type":"page","link":"https:\/\/www.phptutorial.net\/php-oop\/php-static-methods\/","title":{"rendered":"PHP Static Methods and Properties"},"content":{"rendered":"\n<p><strong>Summary<\/strong>:&nbsp;in this tutorial, you will learn about PHP static methods and static properties and understand the differences between the&nbsp; <code>$this<\/code> and <code>self<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-php-static-methods-and-properties'>Introduction to PHP static methods and properties <a href=\"#introduction-to-php-static-methods-and-properties\" class=\"anchor\" id=\"introduction-to-php-static-methods-and-properties\" title=\"Anchor for Introduction to PHP static methods and properties\">#<\/a><\/h2>\n\n\n\n<p>So far, you have learned how to <a href=\"https:\/\/phptutorial.net\/php-oop\/php-objects\/\">define a class<\/a> that consists of methods and properties. To use the methods and properties of the class, you create an object and access these methods and properties via the object.<\/p>\n\n\n\n<p>Since these methods and properties are bound to an instance of the class, they are called instance methods and properties.<\/p>\n\n\n\n<p>PHP allows you to access the methods and properties in the context of a class rather than an object. Such methods and properties are class methods and properties.<\/p>\n\n\n\n<p>Class methods and class properties are called static methods and properties.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='static-methods'>Static methods <a href=\"#static-methods\" class=\"anchor\" id=\"static-methods\" title=\"Anchor for Static methods\">#<\/a><\/h3>\n\n\n\n<p>To define a static method, you place the <code>static<\/code> keyword in front of the <code>function<\/code> keyword as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\">\n<span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">MyClass<\/span>\n<\/span>{\n\t<span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-keyword\">static<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">staticMethod<\/span><span class=\"hljs-params\">()<\/span>\n\t<\/span>{\n\t}\n}\n<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Since a static method is bound to a class, not an individual instance of the class, you cannot access <code>$this<\/code> inside the method. However, you can access a special variable called <code>self<\/code>. The <code>self<\/code> variable means the current class.<\/p>\n\n\n\n<p>The following shows how to call a static method from the inside of the class:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">self<\/span>::staticMethod(arguments);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>To call a static method from the outside of the class, you use the following syntax:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">className::staticMethod(<span class=\"hljs-built_in\">arguments<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">MyClass<\/span><span class=\"hljs-selector-pseudo\">::staticMethod()<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following example defines the <code>HttpRequest<\/code> class that has a static method <code>uri()<\/code> that returns the URI of the current HTTP request:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">HttpRequest<\/span>\n<\/span>{\n\t<span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-keyword\">static<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">uri<\/span><span class=\"hljs-params\">()<\/span>: <span class=\"hljs-title\">string<\/span>\n\t<\/span>{\n\t\t<span class=\"hljs-keyword\">return<\/span> strtolower($_SERVER&#91;<span class=\"hljs-string\">'REQUEST_URI'<\/span>]);\n\t}\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The following calls the <code>uri()<\/code> static method of <code>HttpRequest<\/code> class:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">echo<\/span> HttpRequest::uri();<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If the current HTTP request is <code>https:\/\/phptutorial.net\/php-static-method\/<\/code>, the <code>uri()<\/code> method will return <code>\/php-static-method\/<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='static-properties'>Static properties <a href=\"#static-properties\" class=\"anchor\" id=\"static-properties\" title=\"Anchor for Static properties\">#<\/a><\/h3>\n\n\n\n<p>To define a static property, you also use the <code>static<\/code> keyword:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-keyword\">static<\/span> $staticProperty;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">MyClass<\/span>\n<\/span>{\n\t<span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-keyword\">static<\/span> $staticProperty;\n\n\t<span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-keyword\">static<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">staticMethod<\/span><span class=\"hljs-params\">()<\/span>\n\t<\/span>{\n\t}\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>To access a public static property outside of the class, you also use the class name with the <code>::<\/code> operator:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">MyClass::$staticProperty;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Like the static methods, to access static properties from within the class, you use the <code>self<\/code> instead of&nbsp; <code>$this<\/code> as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">self<\/span>::staticProperty<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='self-vs-this'>self vs. $this <a href=\"#self-vs-this\" class=\"anchor\" id=\"self-vs-this\" title=\"Anchor for self vs. $this\">#<\/a><\/h2>\n\n\n\n<p>The following table illustrates the differences between the <code>self<\/code> and <code>$this<\/code>:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><code>$this<\/code><\/th><th><code>self<\/code><\/th><\/tr><\/thead><tbody><tr><td>Represents an instance of the class or object<\/td><td>Represents a class<\/td><\/tr><tr><td>Always begin with a dollar ($) sign<\/td><td>Never begin with a dollar(<code>$<\/code>) sign<\/td><\/tr><tr><td>Is followed by the object operator (<code>-&gt;<\/code>)<\/td><td>Is followed by the <code>::<\/code> operator<\/td><\/tr><tr><td>The property name after the object operator (<code>-&gt;<\/code>) does not have the dollar ($) sign, e.g., <code>$this-&gt;property<\/code>.<\/td><td>The static property name after the <code>::<\/code> operator always has the dollar (<code>$<\/code>) sign.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='php-static-methods-and-properties-example'>PHP static methods and properties example <a href=\"#php-static-methods-and-properties-example\" class=\"anchor\" id=\"php-static-methods-and-properties-example\" title=\"Anchor for PHP static methods and properties example\">#<\/a><\/h2>\n\n\n\n<p>Suppose that you want to create an <code>App<\/code> class for your web application. And the <code>App<\/code> class should have one and only one instance during the lifecycle of the application. In other words, the <code>App<\/code> should be a singleton.<\/p>\n\n\n\n<p>The following illustrates how to define the App class by using the static methods and properties:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">App<\/span>\n<\/span>{\n\t<span class=\"hljs-keyword\">private<\/span> <span class=\"hljs-keyword\">static<\/span> $app = <span class=\"hljs-keyword\">null<\/span>;\n\n\t<span class=\"hljs-keyword\">private<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">__construct<\/span><span class=\"hljs-params\">()<\/span>\n\t<\/span>{\n\t}\n\n\t<span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-keyword\">static<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">get<\/span><span class=\"hljs-params\">()<\/span> : <span class=\"hljs-title\">App<\/span>\n\t<\/span>{\n\t\t<span class=\"hljs-keyword\">if<\/span> (!<span class=\"hljs-keyword\">self<\/span>::$app) {\n\t\t\t<span class=\"hljs-keyword\">self<\/span>::$app = <span class=\"hljs-keyword\">new<\/span> App();\n\t\t}\n\n\t\t<span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-keyword\">self<\/span>::$app;\n\t}\n\n\t<span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">bootstrap<\/span><span class=\"hljs-params\">()<\/span>: <span class=\"hljs-title\">void<\/span>\n\t<\/span>{\n\t\t<span class=\"hljs-keyword\">echo<\/span> <span class=\"hljs-string\">'App is bootstrapping...'<\/span>;\n\t}\n}<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>How it works:<\/p>\n\n\n\n<p>First, define a static property called $app and initialize its value to <code>null<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">private<\/span> <span class=\"hljs-keyword\">static<\/span> $app = <span class=\"hljs-keyword\">null<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Second, make the <a href=\"https:\/\/phptutorial.net\/php-oop\/php-constructors\/\">constructor<\/a> private so that the class cannot be instantiated from the outside:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">private<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">__construct<\/span><span class=\"hljs-params\">()<\/span>\n<\/span>{\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Third, define a static method called <code>get()<\/code> that returns an instance of the <code>App<\/code> class:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">public<\/span> <span class=\"hljs-keyword\">static<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">get<\/span><span class=\"hljs-params\">()<\/span> : <span class=\"hljs-title\">App<\/span>\n<\/span>{\n\t<span class=\"hljs-keyword\">if<\/span> (!<span class=\"hljs-keyword\">self<\/span>::$app) {\n\t\t<span class=\"hljs-keyword\">self<\/span>::$app = <span class=\"hljs-keyword\">new<\/span> App();\n\t}\n\n\t<span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-keyword\">self<\/span>::$app;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>get()<\/code> method creates an instance of the <code>App<\/code> if it has not been created, otherwise, it just simply returns the App&#8217;s instance. Notice that the <code>get()<\/code> method uses the <code>self<\/code> to access the <code>$app<\/code> static property.<\/p>\n\n\n\n<p>Fourth, the <code>bootstrap()<\/code> method is just for demonstration purposes. In practice, you can place the code that bootstraps the application in this method.<\/p>\n\n\n\n<p>The following shows how to use the <code>App<\/code> class:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span>\n\n$app = App::get();\n$app-&gt;bootstrap();<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/phptutorial.net\/playground\/?q=PD9waHAKCmNsYXNzIEFwcAp7Cglwcml2YXRlIHN0YXRpYyAkYXBwID0gbnVsbDsKCglwcml2YXRlIGZ1bmN0aW9uIF9fY29uc3RydWN0KCkKCXsKCX0KCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGdldCgpIDogQXBwCgl7CgkJaWYgKCFzZWxmOjokYXBwKSB7CgkJCXNlbGY6OiRhcHAgPSBuZXcgQXBwKCk7CgkJfQoKCQlyZXR1cm4gc2VsZjo6JGFwcDsKCX0KCglwdWJsaWMgZnVuY3Rpb24gYm9vdHN0cmFwKCk6IHZvaWQKCXsKCQllY2hvICdBcHAgaXMgYm9vdHN0cmFwcGluZy4uLic7Cgl9Cn0KJGFwcCA9IEFwcDo6Z2V0KCk7CiRhcHAtPmJvb3RzdHJhcCgpOw\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>In this code, we called the <code>get()<\/code> static method from the <code>App<\/code> class and invoked the <code>bootstrap()<\/code> method of the <code>App<\/code>&#8216;s instance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Static methods and properties are bound to a class, not individual objects of the class.<\/li>\n\n\n\n<li>Use the <code>static<\/code> keyword to define static methods and properties.<\/li>\n\n\n\n<li>Use the <code>self<\/code> keyword to access static methods and properties within the class.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Did you find this tutorial useful?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"109\"\n\t\t\t\tdata-post-url=\"https:\/\/www.phptutorial.net\/php-oop\/php-static-methods\/\"\n\t\t\t\tdata-post-title=\"PHP Static Methods and Properties\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"109\"\n\t\t\t\tdata-post-url=\"https:\/\/www.phptutorial.net\/php-oop\/php-static-methods\/\"\n\t\t\t\tdata-post-title=\"PHP Static Methods and Properties\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn about PHP static methods and static properties, and understand the differences between the $this and self.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1753,"menu_order":15,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-109","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/comments?post=109"}],"version-history":[{"count":5,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/109\/revisions"}],"predecessor-version":[{"id":3232,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/109\/revisions\/3232"}],"up":[{"embeddable":true,"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/pages\/1753"}],"wp:attachment":[{"href":"https:\/\/www.phptutorial.net\/wp-json\/wp\/v2\/media?parent=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}