OOP IN PHP

Sugar babies

 PHP :

  • PHP is a recursive acronym for "PHP: Hypertext Preprocessor".
  • PHP is a server side scripting language that is embedded in HTML.
  • It is used to manage dynamic concent, databases, session tracking, even build entire e-commerce sites.

OOP :

  •  OOP is faster and easier to execute.
  •  OOP provides a clear structure for the programs.
  •  OOP helps to keep the PHP code DRY "Don't Repeat Yourself", and makes the code easier to maintain, modify and debug.
  • OOP makes it possible to create full reusable applications with less code and shorter development time.

FOUR PILLARS OF OOP :

  • Encapsulation
  • Inheritance
  • Abstraction
  • Polymorphism

USE OF OOP CLASS IN PHP :

  • PHP being an object oriented programming language.
  • Allows creation of classes and objects to follow.
  • The object oriented programming paradigm while developing any software of application.

EXAMPLE FOR CLASS IN PHP :

<!DOCTYPE html>
<html>
<body>
<?php
echo "Hello World";
?>
 </body>
</html>

OUTPUT :

Hello World 
Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send