Blog Introductions

In this  blog contains tutorials about  HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials,  Examples, Source code,Learning,
Tips and Software development  services. Php Oop Object Orriented Programing  | Php tutorials Bestitworriors


Php Oop Object Orriented Programing

Php tutorials







Php Oop Object Orriented Programing  | Php tutorials Bestitworriors - OOP stands for object-orriented Programing.In oop we create classes which contain variables and function.oop is easier and help us to write clean code.oop is easily to reuse again again classes for multipule function and work.oop is easy to exicute on server.Object define as which have some properties and function e.g car is a object which have properties color,structure ,size and functon is drive ,stop etc.OOP takes less time to code and development process rather then procdural code.


Some Key Points of PHP OOP

  1. OOP stands for object orriented programin
  2. In oop we study and work about object
  3. Object which have some properties and functions
  4. we create class for working on object
  5. Class have constructor
  6. Class have Access Modifiers
  7. public property or method can be accessed from everywhere
  8. protected property or method can be accessed within the class and by classes derived from that class
  9. private - the property or method accessed within the class
  10. Class have Inheritance
  11. Class have Constants
  12. Class have static Methods
  13. Class have static properties

Code



<?php


class Month {
public $month;
public $year;
public function __construct($month, $year) {
$this->month = $month;
$this->year = $year;
}
public function intro() {
echo "<br>";
echo "The Month is {$this->month} and the Year is {$this->year}.";
}

function __destruct() {
echo "<br>";
echo "The month is {$this->month}.";
}
}

// Strawberry is inherited from Fruit
class Years extends Month {
public function message() {
echo "<br>";
echo "I am year Class ";
}
}
$object = new Years(12, 2022);
$object->message();
$object->intro();
?>





OutPut


I am year Class
The Month is 12 and the Year is 2022.
The month is 12.



I hope You really enjoyed this blog . I try my best to make every thing is easy and helpfull to provide to public .You will get more blog about the Programing project and code . Thanks for visiting my blog if you have any querry related to this you can comment here i will try my best to response you back about Php Oop Object Orriented Programing  | Php tutorials Bestitworriors