How to Write Class in OOP PHP ?
This instructional exercise, we will begin from the essential idea of classes . Class is something which characterizes your article. Class speaks to all properties and practices of item. Presently give us a chance to take a sample of the programming. Your advantage adding machine article is case of class interest adding machine. Interest adding machine class characterizes properties like capital rate, and conduct like basic interest count and self multiplying dividends estimation.
In PHP making of class is extremely basic. You can make class utilizing label class. In class piece you can characterize your properties as class variable and capacity as class conduct. Classes and Objects are key a portion of item situated programming
Example:
class MyClass { public $var; // Class constructor public function __construct($var) { echo 'Created an object of MyClass'; $this->var = $var; } public function show_var() { echo $this->var; } } // Make an object $objA = new MyClass('A'); // Call an object method to show the object's property $objA->show_var(); // Make another object and do the same $objB = new MyClass('B'); $objB->show_var();
Read more OOP in PHP
I hope its helpful for every one, contact & ask any question on http://fb.com/smartwebcareindia