{"id":4670,"date":"2021-11-22T11:40:00","date_gmt":"2021-11-22T06:10:00","guid":{"rendered":"https:\/\/selfimagination.in\/tips\/?p=4670"},"modified":"2021-11-22T11:34:41","modified_gmt":"2021-11-22T06:04:41","slug":"php-oops-object-oriented-programming","status":"publish","type":"post","link":"https:\/\/selfimagination.in\/tips\/php-oops-object-oriented-programming\/","title":{"rendered":"PHP OOPs (Object Oriented Programming)"},"content":{"rendered":"\n<p><strong>PHP Object Oriented Programing System (OOPs) : <\/strong>\u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 Data Type \u0914\u0930 Function \u0915\u0947 \u0917\u094d\u0930\u0942\u092a \u0915\u094b \u0939\u092e Class \u0915\u0939 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902, \u090f\u0915 Class \u092e\u0947\u0902 \u0939\u092e \u0905\u0932\u0917 \u0905\u0932\u0917 \u0924\u0930\u0939 \u090f\u0915 Data Type Declare \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 \u092c\u0939\u0941\u0924 \u0938\u0947 \u092b\u0902\u0915\u094d\u0936\u0928 \u092c\u0928\u093e \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 , \u092f\u0939 \u0928\u090f Data Type \u092c\u0928\u093e\u0928\u0947 \u091c\u0948\u0938\u093e \u0939\u0940 \u0939\u0948\u0902 \u0964 \u091c\u092c \u092d\u0940 \u0939\u092e \u090f\u0915 \u092f\u093e \u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 Basic Data Type \u0915\u093e group \u091c\u093f\u0938\u0947 \u0939\u092e\u0947 Class \u092c\u094b\u0932\u0924\u0947 \u0939\u0948\u0902 , \u092c\u0928\u093e\u0924\u0947 \u0939\u0948 \u0924\u094b \u0909\u0938\u0940 \u0938\u0947 \u092b\u093f\u0930 \u0938\u0947 \u0915\u0941\u091b \u091a\u0947\u0902\u091c \u0915\u0930 \u090f\u0915 \u0928\u092f\u093e Data Type \u092c\u0928\u093e \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 , OOPS \u0938\u092e\u091d\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0939\u092e\u0947 \u092a\u0939\u0932\u0947 \u0928\u093f\u092e\u094d\u0928 Concept \u0938\u092e\u091d\u0928\u093e \u0939\u094b\u0902\u0917\u0947  \u091c\u092c \u092f\u0939 Concept \u0939\u092e\u0947 \u0938\u092e\u091d\u0947 \u092e\u0947 \u0906 \u0917\u092f\u0947 \u0924\u094b \u0939\u092e OOPS \u092d\u0940 \u0938\u092e\u091d \u091c\u093e\u090f\u0902\u0917\u0947 \u0964 <\/p>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>PHP Class<\/li><li>PHP Object<\/li><li>PHP Properties (Simple, Static)<\/li><li>PHP Methods (Simple, Static)<\/li><li>PHP Constructor<\/li><li>PHP Destructor<\/li><li>PHP Inheritance<\/li><li>PHP Access Modifier (Public, Private, Protected)<\/li><li>PHP Abstract Class<\/li><li>PHP Interface<\/li><li>PHP Namespace<\/li><li>PHP Traits<\/li><li>PHP Encapsulation<\/li><li>PHP Polymorphism<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Class <\/h2>\n\n\n\n<p>\u091c\u092c \u0939\u092e\u0947 \u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 Datatype \u0913\u0930 function \u091c\u093f\u0928\u094d\u0939\u0947 \u0939\u092e Method \u092c\u094b\u0932\u0924\u0947 \u0939\u0948\u0902, \u0915\u093e \u090f\u0915 Group \u092c\u0928\u093e\u0928\u093e \u0939\u094b \u0924\u094b \u0939\u092e Class \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0964 \u0915\u093f\u0938 \u0924\u0930\u0939 \u0938\u0947 class \u092c\u0928\u093e\u0908 \u091c\u093e\u0924\u0940 \u0939\u0948\u0902 \u0909\u0938\u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947 \u0928\u0940\u091a\u0947 \u092c\u0924\u093e\u092f\u093e \u0939\u0948\u0902 , \u0905\u092d\u0940 \u0907\u0938 Class \u092e\u0947 \u0939\u092e\u0928\u0947 \u0915\u094b\u0908 Properties \u0913\u0930 Method declare \u0928\u0939\u0940\u0902 \u0915\u0940 \u0939\u0948\u0902 \u0907\u0938\u0932\u093f\u090f \u0907\u0938 Class \u0915\u094b \u0939\u092e \u0909\u092a\u092f\u094b\u0917 \u0928\u0939\u0940\u0902 \u0932\u0947 \u092a\u093e\u090f\u0902\u0917\u0947 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Calculator\n{\n\t\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Object <\/h2>\n\n\n\n<p>Class \u0915\u094b \u0939\u092e Direct \u0909\u092a\u092f\u094b\u0917 \u0928\u0939\u0940\u0902 \u0915\u0930 \u0938\u0915\u0924\u0947 , Class \u0915\u093e \u090f\u0915 Object \u092c\u0928\u093e \u0915\u0930 \u0939\u0940 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948 \u0964 \u092f\u0939\u093e \u092a\u0930 \u0939\u092e\u0947\u0902 \u091c\u094b \u092a\u0939\u0932\u0947 Claculator  calss \u092c\u0928\u093e\u0908 \u0925\u0940 \u0909\u0938\u0915\u093e \u090f\u0915 Object $calc \u092c\u0928\u093e\u092f\u093e \u0939\u0948\u0902 , <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">$calc = new Calculator();<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Properties <\/h2>\n\n\n\n<p>\u091c\u094b \u092d\u0940 \u0939\u092e Variable Declare \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0909\u0928\u094d\u0939\u0947 \u091c\u092c \u0915\u093f\u0938\u0940 Class \u092e\u0947 Declare \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0924\u094b \u0909\u0928\u094d\u0939\u0947 Properties \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 , \u0906\u0907\u090f \u0928\u093f\u092e\u094d\u0928 \u0909\u0926\u093e\u0939\u0930\u0923 \u0938\u0947 \u0938\u092e\u091d\u0924\u0947 \u0939\u0948\u0902 \u0964 \u092f\u0939\u093e \u092a\u0930 \u0939\u092e\u0928\u0947 $a, \u0913\u0930 $b \u0926\u094b Properties declare \u0915\u0940 \u0939\u0948\u0902 \u0964  \u091c\u092c \u092d\u0940 \u0906\u092a\u0915\u094b \u0915\u093f\u0938\u0940 \u092d\u0940 Property \u0915\u094b Access \u0915\u0930\u0928\u093e \u0939\u094b \u0924\u094b -&gt; \u0907\u0938 Sign \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Calculator\n{\n\tpublic $a, $b;\t\n\n}\n\n$calc = new Calculator();\n$calc-&gt;a = 10;\n$calc-&gt;b = 20;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Static Properties <\/h2>\n\n\n\n<p>\u092f\u0926\u093f \u0939\u092e \u0915\u093f\u0938\u0940 \u092d\u0940 Property \u0915\u0947 \u092a\u0939\u0932\u0947 static keyword \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0939\u092e \u0909\u0938 Class \u0915\u094b \u092c\u093f\u0928\u093e Object \u092c\u0928\u093e\u090f \u0939\u0940 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 \u092a\u0930\u0902\u0924\u0941 \u091c\u092c \u0939\u092e \u0915\u093f\u0938\u0940 \u092d\u0940 Class \u0915\u0940 Property \u0915\u094b -&gt; \u0907\u0938 Symbol \u0938\u0947 access \u0915\u0930\u0924\u0947 \u0925\u0947 \u0909\u0938\u0947 static \u092e\u0947 :: \u0907\u0938 symbol \u0938\u0947 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0947\u0902\u0917\u0947 , \u0915\u092d\u0940 \u092d\u0940 static keyword \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0939\u092e object \u0928\u0939\u0940\u0902 \u092c\u0928\u093e\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Calculator\n{\n\tpublic static $a, $b;\n}\n\nCalculator::$a = 20;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u0939\u092e\u093e\u0930\u0947 \u0905\u0928\u094d\u092f ARTICLE<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-aggregate-function-in-hindi\/\">MySQL Aggregate Function<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-stored-procedure\/\">MySQL Stored Procedures<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-trigger\/\">MySQL Trigger (Before\/After)<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/php-validation-filter-var-preg_match\/\">PHP Form Validations, Required, Filter<\/a>&nbsp;<\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/dbcmd\/\">PHP MySQL Connection<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/php-dropdown-from-mysql\/\">Dropdown Retrieve from MySQL&nbsp;<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/learn-c-basic-n-advance\/\">Learn C (Single Page Summary)<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/arduino-guide-2021-hindi\/\">Arduino Guide 2021 (Hindi)<\/a><\/li><li><a href=\"https:\/\/blog.learncomputer.selfimagination.in\/2020\/10\/keyboard-shortcut.html\">\u0915\u0940\u092c\u094b\u0930\u094d\u0921 \u0936\u0949\u0930\u094d\u091f\u0915\u091f\u094d\u0938<\/a><\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Method <\/h2>\n\n\n\n<p>\u091c\u092c \u092d\u0940 \u0939\u092e\u0947 \u0915\u093f\u0938\u0940 \u092d\u0940 Class \u092e\u0947 \u0915\u094b\u0908 Function \u092c\u0928\u093e\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0909\u0938\u0947 Method \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0964 Method \u092e\u0947 \u0939\u092e Argument Pass \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0913\u0930 Value Return \u092d\u0940 \u0932\u0947 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Calculator\n{\n\tpublic $a, $b;\n\t\n\tfunction GetValue()\n\t{\n\t\treturn $this-&gt;a;\n\t}\n}\n\n$calc = new Calculator();\n$calc-&gt;a = 10;\n\necho $calc-&gt;GetValue();<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Static Method <\/h2>\n\n\n\n<p>\u091c\u0948\u0938\u093e \u0915\u0940 \u0939\u092e\u0928\u0947 \u0926\u0947\u0916\u0947 \u0915\u0940 Static Property \u092e\u0947 \u0939\u092e\u0947 \u092c\u093f\u0928\u093e Object \u092c\u0928\u093e\u090f \u0939\u0940 class \u0915\u094b \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0925\u0947 \u0909\u0938\u0940 \u092a\u094d\u0930\u0915\u093e\u0930 \u092f\u0926\u093f \u0939\u092e\u0947 \u0915\u094b\u0908 Method \u0915\u094b \u092c\u093f\u0928\u093e Class \u092c\u0928\u093e\u090f \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u093e \u0939\u0948\u0902 \u0924\u094b \u0939\u092e Static Method \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Calculator\n{\n\tstatic function GetStatic()\n\t{\n\t\treturn \"Hello\";\n\t}\t\n}\n\necho Calculator::GetStatic();   \/\/Return Hello <\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Constructor <\/h2>\n\n\n\n<p>Constructor \u090f\u0915 Special Type \u0915\u0940 Method \u0939\u0940 \u0939\u0948\u0902, \u0907\u0938 Method \u0915\u093e \u0928\u093e\u092e \u0939\u092e\u0947 __construct \u0930\u0916\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0964  \u0910\u0938\u093e \u0915\u0930\u0928\u093e \u0938\u0947 \u091c\u092c \u0939\u092e\u093e\u0930\u0947 \u0926\u094d\u0935\u093e\u0930 Class \u0938\u0947 Object Declare \u0915\u093f\u092f\u0947 \u091c\u093e\u0924\u0947 \u0939\u0948\u0902 \u0909\u0938\u0940 \u0938\u092e\u092f \u092f\u0939 Method Call \u0939\u094b \u091c\u093e\u0924\u0940 \u0939\u0948\u0902\u0964 \u0907\u0938\u0940 \u0915\u093e\u0930\u0923 \u0938\u0947 \u0907\u0928\u094d\u0939\u0947 Constructor \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902\u0964 \u0907\u0938\u0947 \u0939\u092e\u0947 \u0905\u0932\u0917 \u0938\u0947 Call \u0928\u0939\u0940\u0902 \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u0940 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Calculator\n{\n\tpublic $a, $b;\n\t\n\tfunction __construct($msg)\n\t{\n\t\techo \"Hello \". $msg;\n\t}\n}\n\n$calc = new Calculator(\"Sandip\");<\/code><\/pre>\n\n\n\n<p>Output<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"132\" height=\"43\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/10\/image-23.png?resize=132%2C43&#038;ssl=1\" alt=\"PHP OOPs Constructor\" class=\"wp-image-4689\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Destructor <\/h2>\n\n\n\n<p>Destructor \u092d\u0940 \u090f\u0915 Special Type \u0915\u0940 Method \u0939\u0940 \u0939\u0948\u0902, \u0907\u0938 Method \u0915\u093e \u0928\u093e\u092e \u0939\u092e\u0947 __destruct  \u0930\u0916\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0964  \u092f\u0939 Method \u091c\u092c php page \u0915\u093e Execution end \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0924\u092c \u092f\u0939 \u0938\u094d\u0935\u0924\u0903 \u0939\u0940 Call \u0939\u094b \u091c\u093e\u0924\u0940 \u0939\u0948\u0902 \u0964 \u091c\u092c \u092d\u0940 \u0939\u092e\u0947 \u0913\u0930 \u0915\u093e\u0930\u094d\u092f Page \u0915\u0947 \u0905\u0902\u0924 \u092e\u0947 \u0915\u0930\u0928\u093e \u0939\u094b \u0924\u094b \u0935\u0939 Statement \u0939\u092e  __destruct() method \u092e\u0947 \u0932\u093f\u0916\u0947 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 \u091c\u0948\u0938\u0947 \u0915\u0940 \u0939\u092e \u092f\u0926\u093f MySQL Connection \u0915\u0940 \u0915\u094b\u0908 Class \u092c\u0928\u093e\u0924\u0947 \u0939\u0948\u0902 \u0913\u0930 \u0939\u092e \u0905\u0902\u0924 \u092e\u0947 Connection Close \u0915\u0930\u0928\u093e \u092d\u0942\u0932 \u091c\u093e\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u092f\u0926\u093f \u0939\u092e  __destruct() Method \u092e\u0947 Connection Close \u0915\u0930\u0947 \u0924\u094b \u0939\u092e\u0947 \u0905\u0932\u0917 \u0938\u0947 Connection Close \u0915\u0930\u0928\u0947 \u0915\u0940 \u0906\u0935\u0936\u094d\u092f\u0915\u0924\u093e \u0928\u0939\u0940\u0902 \u0939\u094b\u0917\u0940 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Calculator\n{\n\tpublic $a, $b;\n\t\n\tfunction __construct($msg)\n\t{\n\t\techo \"Hello \". $msg;\n\t}\n\t\n\tfunction __destruct()\n\t{\n\t\techo \"&lt;br&gt;Bye Bye \";\n\t}\n}\n\n$calc = new Calculator(\"Sandip\");<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"132\" height=\"65\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/10\/image-24.png?resize=132%2C65&#038;ssl=1\" alt=\"\" class=\"wp-image-4694\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Class Inheritance<\/h2>\n\n\n\n<p>\u091c\u092c \u0939\u092e \u090f\u0915 Class \u092c\u0928\u093e \u0915\u0930 \u0909\u0938 Class \u0938\u0947 \u090f\u0915 \u0914\u0930 Class \u092c\u0928\u093e \u0932\u0947\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0909\u0938\u0947 \u0939\u0940 Inheritance \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0964 \u0910\u0938\u093e \u0939\u092e \u092c\u0939\u0941\u0924 \u092c\u093e\u0930 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964 \u091c\u094b \u0928\u092f\u0940 Class \u092c\u0928\u0924\u0940 \u0939\u0948\u0902 \u0909\u0938\u092e\u0947 \u091c\u093f\u0924\u0928\u0947 \u092d\u0940 Attribute \u0914\u0930 Method Protect \u0914\u0930 Public \u0939\u0948\u0902 \u0938\u092d\u0940 Visible \u0939\u094b\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 \u0939\u092e \u0938\u093e\u0925 \u092e\u0947\u0902 \u0915\u0941\u091b \u0928\u092f\u0947 Attribute \u0914\u0930 Method \u092c\u0928\u093e \u092d\u0940 \u0938\u0915\u0924\u0947 \u0939\u0948\u0964<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Calculator\n{\n\tpublic $a, $b;\n\t\n\tfunction GetValue()\n\t{\n\t\treturn $this-&gt;a;\n\t}\n\t\n}\n\nclass StandardCalc extends Calculator\n{\n\tfunction SetValue($val)\n\t{\n\t\t$this-&gt;a = $val;\n\t}\n}\n\n$calc = new StandardCalc();\n$calc-&gt;SetValue(20);\necho $calc-&gt;GetValue();   \/\/Print 20<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\"><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Multilevel Inheritance :<\/strong>&nbsp;\u091c\u0948\u0938\u093e \u0915\u0940 \u0939\u092e\u0947\u0902 \u0928\u093e\u092e \u0938\u0947 \u0939\u0940 \u0938\u092e\u091d \u092e\u0947\u0902 \u0906 \u0930\u0939\u093e \u0939\u0948\u0902 \u0915\u0940 \u092f\u0939\u093e\u0901 \u092a\u0930 \u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 \u0932\u0947\u0935\u0932 \u0939\u0948\u0902 \u091c\u0948\u0938 \u0915\u0940 Class A \u0938\u0947 Inherit \u0915\u0930 Class B \u092c\u0928\u093e\u092f\u0940\u0902 \u0939\u0948\u0902 \u0914\u0930 B \u0938\u0947 Inherit \u0915\u0930 Class C \u092c\u0928\u093e\u092f\u0940\u0902 \u0939\u0948\u0902 \u0914\u0930 C \u0938\u0947 Inherit \u0915\u0930 Class D \u092c\u0928\u093e\u092f\u0940\u0902 \u0939\u0948\u0902 \u0907\u0938 \u0924\u0930\u0939 \u0915\u0947 Inheritance \u0915\u094b Multilevel Inheritance \u0915\u0939\u093e\u0901 \u091c\u093e\u0924\u093e \u0939\u0948\u0902\u0964<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class ClassA\n{\n}\n\nclass ClassB extends ClassA\n{\n}\n\nclass ClassC extends ClassB\n{\n}\n\nclass ClassD extends ClassC\n{\n}\n<\/code><\/pre>\n\n\n\n<p><strong>Multiple Inheritance :<\/strong>&nbsp;PHP Multiple Inheritance \u0915\u094b support \u0928\u0939\u0940\u0902 \u0915\u0930\u0924\u093e \u0939\u0948\u0902 , \u0907\u0938\u0915\u0947 \u0932\u093f\u090f \u0906\u0917\u0947 \u0906\u092a\u0915\u094b Interface \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947 \u092c\u0924\u093e\u090f\u0902\u0917\u0947 \u0964 <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Access Modifier (Public, Private, Protected)<\/h2>\n\n\n\n<p>Class \u092e\u0947\u0902 \u091c\u094b \u0939\u092e Property \u0914\u0930 Method \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0909\u0928\u0915\u094b \u092d\u0940 \u0939\u092e\u0947\u0902 Secure \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0909\u0928\u0915\u0947 Access Specifier Set \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u092f\u093e\u0928\u093f \u0915\u0940 \u091c\u092c \u0939\u092e \u0907\u0938 Class \u0915\u093e \u0915\u094b\u0908 object \u092c\u0928\u093e\u092f\u0947 \u0924\u094b \u0909\u0938 Object \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0938\u092e\u092f \u092f\u0926\u093f \u0939\u092e \u0915\u094b\u0908 Attribute \u092f\u093e Method Hide \u0915\u0930\u0928\u093e \u091a\u093e\u0939\u0947 \u0924\u094b Hide \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 , \u092f\u0939\u093e\u0901 \u092a\u0930 Hide \u0938\u0947 \u092e\u0924\u0932\u092c \u092f\u0939 \u0939\u0948\u0902 \u0915\u0940 Object \u0938\u0947 \u092b\u093f\u0930 Hide \u0915\u093f\u092f\u0947 \u0939\u0941\u090f Attribute \u0914\u0930 Method \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0928\u0939\u0940\u0902 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902, \u0907\u0928\u094d\u0939\u0947 \u092d\u0940 3 \u092d\u093e\u0917\u094b \u092e\u0947\u0902 \u092c\u093e\u0902\u091f\u093e \u0917\u092f\u093e \u0939\u0948\u0902\u0964<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Public :&nbsp;<\/strong>\u092f\u0926\u093f \u0939\u092e Attribute \u0915\u094b \u0938\u092d\u0940 \u091c\u0917\u0939 \u092a\u0930 Access \u0915\u0930\u0928\u0947 \u0915\u0947 Rights \u0926\u0947\u0928\u093e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0939\u092e \u0909\u0938\u0947 Public Access \u0926\u0947\u0924\u0947 \u0939\u0948\u0902 \u091c\u093f\u0938\u0938\u0947 \u092f\u0939 Method \u0914\u0930 Attribute \u0938\u092d\u0940 \u091c\u0917\u0939 \u092a\u0930 Visible \u0914\u0930 Accessible \u0939\u094b\u0924\u0947 \u0939\u0948\u0902\u0964<\/li><li><strong>Private :<\/strong>&nbsp;\u092f\u0926\u093f \u0939\u092e Attribute \u0915\u094b \u0915\u0947\u0935\u0932 \u0914\u0930 \u0915\u0947\u0935\u0932 \u091c\u093f\u0938 Class \u092e\u0947\u0902 Define \u0939\u0948\u0902 \u0935\u0939\u0940 \u092a\u0930 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u093e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0909\u0938\u0947 Private Access Control \u0926\u0947\u0924\u0947 \u0939\u0948\u0902 \u0924\u093e\u0915\u093f \u0935\u0939 \u0909\u0938 Class \u0915\u0947 \u092c\u093e\u0939\u0930 Access \u0928\u0939\u0940\u0902 \u0939\u094b\u0924\u0940 \u0939\u0948\u0902\u0964 \u092f\u0926\u093f \u0939\u092e \u0915\u093f\u0938\u0940 \u092d\u0940 Attribute \u0914\u0930 Method \u0915\u094b Private \u0915\u0930 \u0926\u0947\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0935\u0939 Secure \u0939\u094b \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0914\u0930 Class \u0915\u0947 \u092c\u093e\u0939\u0930 Visible \u092d\u0940 \u0928\u0939\u0940\u0902 \u0930\u0939\u0924\u093e \u0939\u0948\u0902\u0964<\/li><li><strong>Protected :<\/strong>&nbsp;\u092f\u0926\u093f \u0939\u092e \u0915\u093f\u0938\u0940 \u092d\u0940 Attribute \u0915\u094b Protected \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0935\u0939 Inherit \u0939\u094b \u0915\u0930 Inherited Class \u092e\u0947\u0902 \u0924\u094b visible \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0932\u0947\u0915\u093f\u0928 \u092f\u0926\u093f Class \u0938\u0947 Object \u092c\u0928\u093e\u092f\u093e \u091c\u093e\u092f\u0947 \u0924\u094b Object \u092e\u0947\u0902 Access \u0928\u0939\u0940\u0902 \u0939\u094b\u0924\u093e \u0939\u0948\u0902, \u091c\u092c \u0939\u092e \u090f\u0915 Class \u0938\u0947 Inherit \u0915\u0930 \u0926\u0942\u0938\u0930\u0940 Class \u092c\u0928\u093e\u092f\u0947\u0917\u0947\u0902 \u0924\u094b \u092f\u0939 Visible \u0930\u0939\u0947\u0917\u093e \u0914\u0930 \u091c\u0948\u0938\u0947 \u0939\u0940 \u0909\u0938 Class \u0938\u0947 \u0915\u094b\u0908 Object \u092c\u0928\u093e\u090f\u0902\u0917\u0947 \u0924\u094b \u092f\u0939 Object \u092e\u0947\u0902 invisible \u0939\u094b \u091c\u093e\u092f\u0947\u0917\u093e\u0964<\/li><\/ul>\n\n\n\n<p>  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Calculator\n{\n\tpublic $a;\n\tprivate $b;\n\tprotected $c;\n\t\n\tfunction SetValue($x, $y, $z)\n\t{\n\t\t$this-&gt;a = $x;\n\t\t$this-&gt;b = $y;\n\t\t$this-&gt;c = $z;\n\t}\n}\n\nclass StandardCalc extends Calculator\n{\n\tfunction PrintValue()\n\t{\n\t\techo \"&lt;br&gt;A:\" .$this-&gt;a;\n\t\techo \"&lt;br&gt;B:\" .$this-&gt;b;  \/\/Give Error  Becoze $b is Private\n\t\techo \"&lt;br&gt;C:\" .$this-&gt;c;\n\t}\n}\n\n$calc = new StandardCalc();\n$calc-&gt;SetValue(10,20,30);\n$calc-&gt;PrintValue();\n\n$calc-&gt;a = 15;\n$calc-&gt;b = 25;\n$calc-&gt;c = 35;  \/\/ Give Error Becoze $c is Protected<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Abstract Class<\/h2>\n\n\n\n<p>Abstract Class \u0907\u0938 \u0924\u0930\u0939 \u0915\u0940 Class \u0939\u094b\u0924\u0940 \u0939\u0948\u0902 \u091c\u093f\u0928\u092e\u0947 method \u0915\u094b \u0915\u0947\u0935\u0932 Declare \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0913\u0930 \u0909\u0928\u0915\u094b Impliment \u092f\u093e\u0928\u093f \u0915\u0940 method \u092e\u0947 Script \u0928\u0939\u0940\u0902 \u0932\u093f\u0916\u0940 \u091c\u093e\u0924\u0940 , Method \u0915\u094b inheritance \u0915\u0930\u0928\u0947 \u0915\u0947 \u092c\u093e\u0926 Impliment \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">abstract class ClassA\n{\n\tpublic $msg;\n\tabstract function PrintValue();\n\tfunction SetValue($val)\n\t{\n\t\t$this-&gt;msg = $val;\n\t}\t\n}\n\nclass ClassB extends ClassA\n{\n\t function PrintValue()\n\t {\n\t\techo \"Hello, \". $this-&gt;msg;;\n\t }\n}\n\n$a = new ClassB;\n$a-&gt;SetValue(\"Sandip\");\n$a-&gt;PrintValue();<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>\u092f\u0926\u093f \u0939\u092e \u0915\u093f\u0938\u0940 \u092d\u0940 Method \u0915\u0947 \u092a\u0939\u0932\u0947 absctract keyword \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0909\u0938 Method \u0915\u0940 Body \u092e\u0947 \u0915\u0941\u091b \u0932\u093f\u0916 \u0928\u0939\u0940\u0902 \u0938\u0915\u0924\u0947 \u0964 \u0906\u092a\u0928\u0947 \u0926\u0947\u0916\u093e \u0939\u094b\u0917\u093e \u0915\u0940 abstract function  PrintValue(); \u0915\u0940 Body \u092e\u0947 \u0915\u0941\u091b \u0928\u0939\u0940\u0902 \u0932\u093f\u0916\u093e \u0939\u0948\u0902 \u0964<\/li><li>\u092f\u0926\u093f \u0939\u092e\u0947\u0902 \u0915\u093f\u0938\u0940 class \u092e\u0947 \u090f\u0915 \u092d\u0940 abstract Method \u092c\u0928\u093e\u0908 \u0939\u0948\u0902 \u0924\u094b \u0939\u092e\u0947 \u0915\u094d\u0932\u093e\u0938 \u0915\u094b \u092d\u0940 abstract \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0964 \u091c\u0948\u0938\u093e \u0915\u0940 ClassA \u0915\u094b \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0964 <\/li><li>absctract class \u0915\u093e Object \u0928\u0939\u0940\u0902 \u092c\u0928\u093e \u0938\u0915\u0924\u0947 , \u0909\u0938\u0915\u094b Inherit \u0915\u0930 \u090f\u0915 Class \u092c\u0928\u093e \u0915\u0930 \u0909\u0938\u092e\u0947 Impliment \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 Impliment \u0938\u0947 \u092e\u0924\u0932\u092c method \u0915\u0940 body \u092e\u0947 Script \u0932\u093f\u0916\u0928\u0947 \u0938\u0947 \u0939\u0948\u0902 \u0964 \u0906\u092a\u0928\u0947 \u0926\u0947\u0916\u093e \u0939\u094b\u0917\u093e ClassA \u0938\u0947 Inherit \u0915\u0930 ClassB \u092c\u0928\u093e\u0908 \u0939\u0948\u0902 \u0914\u0930 \u092b\u093f\u0930 ClassB \u0938\u0947 object \u092c\u0928\u093e\u092f\u093e \u0939\u0948\u0902 \u0964 \u0914\u0930 \u0909\u0938\u0940 \u092e\u0947  PrintValue \u0915\u094b Impliment \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0964<\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Interface<\/h2>\n\n\n\n<p>Interface abstract class \u091c\u0948\u0938\u093e \u0939\u0940 \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0915\u0947\u0935\u0932 \u0907\u0938\u092e\u0947 \u0939\u092e \u0915\u094b\u0908 \u092d\u0940 Property Declare \u0928\u0939\u0940\u0902 \u0915\u0930 \u0938\u0915\u0924\u0947 \u091c\u0948\u0938\u093e \u0915\u0940 \u0906\u092a\u0928\u0947 \u0926\u0947\u0916\u093e \u0939\u094b\u0917\u093e \u0915\u0940 Previous Example \u092e\u0947 \u0939\u092e\u0928\u0947 ClassA \u092e\u0947 $msg \u0928\u093e\u092e \u0938\u0947 \u090f\u0915 Property \u092c\u0928\u093e\u0908 \u0939\u0948 \u0964 <\/p>\n\n\n\n<p>\u091c\u094b \u0939\u092e\u0928\u0947 \u0905\u092d\u0940 PHP Abstract Class \u0915\u093e Example \u0926\u0947\u0916\u093e \u0925\u093e \u0909\u0938\u0940 \u0915\u094b Modify \u0915\u0930 \u0939\u092e\u0928\u0947 Interface \u0915\u093e Example \u092c\u0928\u093e\u092f\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">interface InterfaceA\n{\n\tfunction PrintValue();\n\tfunction SetValue($val);\n}\n\nclass ClassB implements InterfaceA\n{\n\tfunction PrintValue()\n\t{\n\t\techo \"Hello, \". $this-&gt;msg;;\n\t}\n\tfunction SetValue($val)\n\t{\n\t\t$this-&gt;msg = $val;\n\t}\t\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Interface \u092e\u0947 \u0915\u093f\u0938\u0940 \u092d\u0940 Method \u0915\u094b Impliment \u0928\u0939\u0940\u0902 \u0915\u0930 \u0938\u0915\u0924\u0947 <\/li><li>Interface \u092e\u0947 \u0939\u092e \u0915\u094b\u0908 \u092d\u0940 Property Declare \u0928\u0939\u0940\u0902 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Namespace<\/h2>\n\n\n\n<p>\u091c\u092c \u092d\u0940 \u0939\u092e \u0915\u093f\u0938\u0940 \u092c\u095c\u0947 Project \u092a\u0930 \u0915\u093e\u0930\u094d\u092f \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u092c \u0939\u092e\u0947 \u092c\u0939\u0941\u0924 \u0938\u0947 \u0915\u094b\u0921 \u0915\u093f\u0938 Previous App \u0938\u0947 \u092d\u0940 Copy \u0915\u0930 \u0930\u0916\u0928\u093e \u0939\u094b\u0924\u0947 \u0939\u0948\u0902 , \u0932\u0947\u0915\u093f\u0928 \u0910\u0938\u093e \u0915\u0930\u0928\u0947 \u092a\u0930 \u0915\u092d\u0940 \u0915\u092d\u0940 \u0938\u092e\u0938\u094d\u092f\u093e \u0906\u0924\u0940 \u0939\u0948\u0902 \u0915\u0940 \u090f\u0915 \u091c\u0948\u0938\u0947 \u0928\u093e\u092e \u0915\u0940 Class \u0926\u094b\u0928\u094b\u0902 \u0939\u0940 Directory \u092e\u0947 \u0930\u0939\u0924\u0940 \u0939\u0948\u0902 , \u0907\u0938 \u0924\u0930\u0939 \u0915\u0940 Problem \u0915\u094b Solve \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f namespace \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<p>\u092e\u0948\u0902 \u0906\u092a\u0915\u094b \u090f\u0915 Example \u0938\u0947 \u0938\u092e\u091d\u093e\u0924\u093e \u0939\u0941, \u0928\u093f\u092e\u094d\u0928 Example \u092e\u0947 \u0939\u092e\u093e\u0930\u0947 \u092a\u093e\u0938 \u090f\u0915 \u0939\u0940 \u0928\u093e\u092e \u0915\u0940 \u0926\u094b Class \u0939\u0948\u0902 \u0913\u0930 \u0909\u0938\u092e\u0947 Method \u092d\u0940 \u090f\u0915 \u091c\u0948\u0938\u0940 \u0939\u0948\u0902 \u0964 \u0914\u0930 \u0926\u094b\u0928\u094b\u0902 \u0905\u0932\u0917 \u0905\u0932\u0917 File \u092e\u0947 Save \u0939\u0948\u0902, \u0907\u0938 Example \u092e\u0947 \u0939\u092e dono file \u0915\u094b include \u0915\u0930 \u0926\u094b\u0928\u094b\u0902 \u0915\u0940 Method \u0915\u094b Print \u0915\u0930 \u0926\u0947\u0916\u0947\u0902\u0917\u0947 \u0924\u093e\u0915\u093f \u0906\u092a\u0915\u094b \u0938\u092e\u091d \u0906 \u0938\u0915\u0947 \u0915\u0940 Namespace \u0915\u093f\u0938 \u0924\u0930\u0939 \u0938\u0947 \u0915\u093e\u0930\u094d\u092f \u0915\u0930\u0924\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre title=\"ns_first.php\" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php \nnamespace first \n{\n\tclass MyClass \n\t{\n\t\tfunction MyMethod()\n\t\t{\n\t\t\techo \"First Class&lt;br&gt;\";\n\t\t}\t\t\n\t}\n}\n?&gt;<\/code><\/pre>\n\n\n\n<pre title=\"ns_second.php\" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php \nnamespace second  \n{\n\tClass MyClass \n\t{\n\t\tfunction MyMethod()\n\t\t{\n\t\t\techo \"Second Class&lt;br&gt;\";\n\t\t}\t\t\n\t}\n}\n?&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0928\u093f\u092e\u094d\u0928 Example \u092e\u0947 \u0939\u092e\u0928\u0947 \u091c\u094b \u0926\u094b File \u092e\u0947 \u090f\u0915 \u0939\u0940 \u0928\u093e\u092e \u0915\u0940 class \u092c\u0928\u093e\u0908 \u0939\u0948\u0902 \u0909\u0928\u0915\u094b require \u0915\u0940 \u0939\u0948\u0902 \u0964 <\/li><li>namspace \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \\ \u0915\u0947 \u0938\u093e\u0925 namespace \u0915\u093e \u0928\u093e\u092e \u0932\u093f\u0916\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 \u091c\u0948\u0938\u093e \u0915\u0940 \u0939\u092e\u0928\u0947 \\first \u0914\u0930 \\second \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0964 <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">require (\"ns_first.php\");\nrequire (\"ns_second.php\");\n\n\n$ObjA = new \\first\\MyClass();\n$ObjA-&gt;MyMethod();\n\n$ObjB = new \\Second\\MyClass();\n$ObjB-&gt;MyMethod();\n<\/code><\/pre>\n\n\n\n<p><strong>Output <\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"133\" height=\"56\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/10\/image-26.png?resize=133%2C56&#038;ssl=1\" alt=\"PHP OOPs Namspace Example \" class=\"wp-image-4732\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Traits<\/h2>\n\n\n\n<p>PHP Traits \u090f\u0915 \u0910\u0938\u093e Concept \u0939\u0948\u0902 \u091c\u093f\u0938\u0938\u0947 \u0915\u0940 \u0939\u092e\u0947 Multiple Inheritance \u0915\u0930\u0928\u0947 \u0915\u0940 \u0938\u0941\u0935\u093f\u0927\u093e \u0926\u0947\u0924\u093e \u0939\u0948\u0902 \u0964 \u0906\u092a\u0928\u0947 \u0926\u0947\u0916\u093e \u0939\u094b\u0917\u093e \u0915\u0940 \u0939\u092e \u0915\u094b\u0908 \u0926\u094b class \u0938\u0947 Inherit \u0915\u0930 \u090f\u0915 Class PHP \u092e\u0947 \u0928\u0939\u0940\u0902 \u092c\u0928\u093e \u0938\u0915\u0924\u0947, \u092f\u0926\u093f \u0906\u092a \u0926\u094b class \u0938\u0947 inherit \u0915\u0930 \u090f\u0915 class \u092c\u0928\u093e\u0928\u093e \u091a\u093e\u0939\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0906\u092a Trait \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0906\u0938\u093e\u0928\u0940 \u0938\u0947 Multiple Inheritance \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">trait MyTrait1 \n{\n\tpublic $Counter1 = 0 ;\n\tpublic function MyMethod1() \n\t{\n\t\t$this-&gt;Counter1 ++;\n\t\techo \"Test1 Message ($this-&gt;Counter1)&lt;br&gt;\";\n\t}\n}\n\ntrait MyTrait2  \n{\n\tpublic $Counter2 = 0 ;\n\tpublic function MyMethod2() \n\t{\n\t\t$this-&gt;Counter2 ++;\n\t\techo \"Test2 Message ($this-&gt;Counter2)&lt;br&gt;\";\n\t}\n}\n\nclass MyClass  \n{\n  use MyTrait1, MyTrait2 ;\n}\n\n$MyObj = new MyClass();\n$MyObj-&gt;MyMethod1();\n$MyObj-&gt;MyMethod2();\n$MyObj-&gt;MyMethod1();\n$MyObj-&gt;MyMethod2();<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"171\" height=\"106\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/10\/image-25.png?resize=171%2C106&#038;ssl=1\" alt=\"PHP OOPs Trait Example \" class=\"wp-image-4729\"\/><\/figure>\n\n\n\n<p>\u0909\u092a\u0930\u094b\u0915\u094d\u0924 Example \u092e\u0947 \u0939\u092e\u0928\u0947 \u0926\u094b Traits \u0932\u093f\u090f \u0939\u0948\u0902 \u0913\u0930 \u090f\u0915 Class \u0932\u0940 \u0939\u0948\u0902 , Class \u092e\u0947 \u0939\u092e\u0928\u0947 \u0926\u094b\u0928\u094b\u0902 \u0939\u0940 Traits \u0915\u094b Use \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0964 \u0913\u0930 \u091c\u092c \u0939\u092e\u0928\u0947 Class \u0938\u0947 object \u092c\u0928\u093e\u092f\u093e \u0924\u094b \u0909\u0938\u092e\u0947 \u0939\u092e\u0928\u0947 \u0926\u094b\u0928\u094b\u0902 Traits \u0915\u0940 Method \u0915\u094b Call \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0914\u0930 \u0938\u093e\u0925 \u092e\u0947 Property \u0915\u093e \u092d\u0940 \u0909\u092a\u092f\u094b\u0917 \u0915\u093f\u092f\u093e \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<p>\u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 \u092c\u093e\u0930 Call \u0915\u0930 \u0939\u092e\u0928\u0947 \u092f\u0939 \u092d\u0940 \u0926\u0947\u0916 \u0932\u093f\u092f\u093e \u0915\u0940 Property \u0920\u0940\u0915 \u0938\u0947 \u0915\u093e\u0930\u094d\u092f \u0915\u0930\u0924\u0940 \u0939\u0948\u0902 \u092f\u093e \u0928\u0939\u0940\u0902 \u0964 <\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Encapsulation <\/h2>\n\n\n\n<p>\u091c\u092c \u092d\u0940 \u0939\u092e \u0915\u093f\u0938 \u092d\u0940 Property \u0915\u094b Private Access Provide \u0915\u0930 \u0926\u0947\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0935\u0939 \u0928 \u0939\u0940 Inherit Class \u0914\u0930 \u0928 \u0939\u0940 Object \u092e\u0947\u0902 Visible \u0939\u094b\u0924\u093e \u0939\u0948\u0902 , \u092f\u093e\u0928\u093f \u0915\u0940 \u0928 \u0939\u0940 \u0939\u092e \u0909\u0938\u0915\u0940 Value \u0915\u094b Get \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 \u0928 \u0939\u0940 \u0909\u0938\u0915\u0940 Value \u0915\u094b Set \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964 \u092f\u0926\u093f \u0939\u092e Encapsulation \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0939\u092e Property \u0915\u094b \u0924\u094b Private \u0939\u0940 \u0930\u0916\u0924\u0947 \u0939\u0948\u0902 \u0932\u0947\u0915\u093f\u0928 Method \u0915\u094b Public \u0930\u0916 \u0915\u0930 \u0909\u0938 Method \u092e\u0947\u0902 Attribute \u092e\u0947\u0902 Value Set \u0915\u0930\u0928\u093e \u0914\u0930 Value Get \u0915\u0930\u0928\u0947 \u0915\u093e \u0915\u093e\u0930\u094d\u092f \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964<\/p>\n\n\n\n<p>\u0939\u092e \u092f\u0939 \u0915\u0939 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0915\u0940 Encapsulation \u0915\u0947 \u0926\u094d\u0935\u093e\u0930\u093e \u0939\u092e Private Attribute \u0915\u093e \u092d\u0940 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u092f\u0926\u093f Creator \u0928\u0947 \u0915\u094b\u0908 Public Method \u092c\u0928\u093e \u0915\u0930 Attribute \u0915\u094b Access \u0915\u0930\u0928\u0947 \u0915\u0940 permission \u0926\u0940 \u0939\u094b \u0924\u094b\u0964<\/p>\n\n\n\n<p>\u092f\u0939 Security \u0915\u0947 \u0932\u093f\u090f \u090f\u0915 \u0905\u091a\u094d\u091b\u093e Concept \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\nclass Calculator\n{\n\tprivate  $a, $b;\n\t\n\tfunction SetFirstValue($val)\n\t{\n\t\t$this-&gt;a = $val;\n\t}\t\n\t\n\tfunction SetSecondValue($val)\n\t{\n\t\t$this-&gt;b = $val;\n\t}\t\n\t\n\tfunction GetValue()\n\t{\n\t\techo \"&lt;br&gt;A:$this-&gt;a\";\n\t\techo \"&lt;br&gt;A:$this-&gt;b\";\n\t}\t\n}\n\n$Obj = new Calculator;\n$Obj-&gt;SetFirstValue(10);\n$Obj-&gt;SetSecondValue(20);\n$Obj-&gt;GetValue();\n?&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0907\u0938 Example \u092e\u0947 \u0939\u092e\u0928\u0947 $a \u0914\u0930 $b \u0915\u094b private \u092c\u0928\u093e\u092f\u093e \u0939\u0948\u0902 \u0924\u093e\u0915\u093f \u0907\u0938\u0915\u093e \u0909\u092a\u092f\u094b\u0917 Outside Class \u0915\u0947 \u0928 \u0939\u094b \u0938\u0915\u0947 \u0964 <\/li><li>$a \u0914\u0930 $b  \u092e\u0947 value set \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0939\u092e\u0928\u0947 \u0926\u094b Method  SetFirstValue(),  SetSecondValue()  \u092c\u0928\u093e\u0908 \u0939\u0948\u0902 \u0964 <\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">PHP Polymorphism <\/h2>\n\n\n\n<p>\u091c\u092c \u0939\u092e \u0915\u093f\u0938\u0940 Class \u0915\u094b Inherit \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0909\u0938 Class \u0915\u0940 Method \u0915\u094b \u0939\u092e \u0928\u092f\u0940 Class \u092e\u0947\u0902 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964 \u092f\u0926\u093f \u0939\u092e \u0909\u0938 Method \u0915\u0947 \u0928\u093e\u092e \u0938\u0947 \u090f\u0915 \u0905\u0928\u094d\u092f Method \u092c\u0928\u093e \u0932\u0947\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0907\u0938\u0947 \u0939\u0940 Polymorphism \u0915\u0939\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0902 , \u0905\u0928\u094d\u092f \u0936\u092c\u094d\u0926\u094b\u0902 \u092e\u0947\u0902 \u0939\u092e \u0915\u0939 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0915\u0940 \u090f\u0915 Method \u0915\u093e \u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 Class \u092e\u0947\u0902 \u0905\u0932\u0917 \u2013 \u0905\u0932\u0917 \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0928\u093e \u0939\u0940 Polymorphism \u0939\u0948\u0902 \u0935\u0948\u0938\u0947 \u092d\u0940 poly \u0915\u093e \u092e\u0924\u0932\u092c \u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 \u0939\u094b\u0924\u093e \u0939\u0948\u0902\u0964<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class ClassA\n{\n\tfunction PrintName($val)\n\t{\n\t\techo \"&lt;br&gt;Hello, \".  $val;\n\t}\t\n}\nclass ClassB extends ClassA\n{\n\tfunction PrintName($val)\n\t{\n\t\techo \"&lt;br&gt;Hi, \".  $val;\n\t}\t\n}\n\n$ObjA = new ClassA;\n$ObjA-&gt;PrintName(\"Sandip\");\n\n$ObjB = new ClassB;\n$ObjB-&gt;PrintName(\"Sandip\");<\/code><\/pre>\n\n\n\n<p><strong>Output <\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"132\" height=\"60\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/10\/image-27.png?resize=132%2C60&#038;ssl=1\" alt=\"PHP OOPs Polymorphism Example \" class=\"wp-image-4742\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>\u092f\u0939\u093e \u092a\u0930 \u0939\u092e\u0928\u0947 \u090f\u0915 Class ClassA \u0938\u0947 Inherit \u0915\u0930 \u090f\u0915 \u0914\u0930 Class ClassB  \u092c\u0928\u093e\u0908 \u0939\u0948\u0902 , <\/li><li>\u0914\u0930  PrintName Method \u092d\u0940 \u0926\u094b\u0928\u094b\u0902 \u0939\u0940 Class \u092e\u0947 \u0939\u0948\u0902 \u0964 <\/li><li>\u0905\u092c \u0939\u092e\u0928\u0947 \u090f\u0915 \u090f\u0915 \u0915\u0930 \u0926\u094b\u0928\u094b\u0902 \u0915\u0940 Class \u0915\u0947 Object \u092c\u0928\u093e\u092f\u0947 <\/li><li>\u0906\u092a \u091c\u092c \u0907\u0928\u0915\u093e Output \u0926\u0947\u0916\u0947\u0902\u0917\u0947 \u0924\u094b \u092a\u093e\u090f\u0902\u0917\u0947 \u0915\u0940 \u092c\u093e\u0926 \u0935\u093e\u0932\u0940 Class \u092e\u0947 PrintName Method \u092c\u093e\u0926 \u0935\u093e\u0932\u0940 \u092f\u093e\u0928\u093f \u0915\u0940 ClassB \u0939\u0940 Execute \u0939\u0941\u0906 \u0939\u0948\u0902 \u0964 <\/li><li>\u0907\u0938\u0940 Concept \u0915\u094b Polymarphism \u0915\u0939\u0924\u0947 \u0939\u0948\u0902 \u0964 <\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP Object Oriented Programing System (OOPs) : \u090f\u0915 \u0938\u0947 \u0905\u0927\u093f\u0915 Data Type \u0914\u0930 Function \u0915\u0947 \u0917\u094d\u0930\u0942\u092a \u0915\u094b \u0939\u092e Class \u0915\u0939 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902, \u090f\u0915 Class \u092e\u0947\u0902 \u0939\u092e \u0905\u0932\u0917 \u0905\u0932\u0917 \u0924\u0930\u0939 \u090f\u0915 Data Type Declare \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 \u092c\u0939\u0941\u0924 \u0938\u0947 \u092b\u0902\u0915\u094d\u0936\u0928 \u092c\u0928\u093e \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 , \u092f\u0939 \u0928\u090f Data Type \u092c\u0928\u093e\u0928\u0947 \u091c\u0948\u0938\u093e \u0939\u0940 \u0939\u0948\u0902 \u0964 \u091c\u092c \u092d\u0940 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4750,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-4670","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/10\/php-oops.jpg?fit=1200%2C628&ssl=1","_links":{"self":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/4670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/comments?post=4670"}],"version-history":[{"count":74,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/4670\/revisions"}],"predecessor-version":[{"id":5345,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/4670\/revisions\/5345"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media\/4750"}],"wp:attachment":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media?parent=4670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/categories?post=4670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/tags?post=4670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}