Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOps School!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Class & Object(php OOPS concept)

OOPS ( Object Oriented Programming System)

Object means a real-world entity such as a pen, chair, table, computer, watch, etc. Object-Oriented Programming is a methodology  to design a program using classes and objects. It simplifies software development and maintenance by providing some concepts.

PHP(Hypertext preprocessor) Programming Patterns:

1)Procedural / Core PHP

2)Object Oriented (Object Oriented method is more popular then Core PHP )

OBJECT ORIENTED Advantage

  • Code more Modular and Reusable
  • Well Organized Code
  • Easier to debug
  • Best for medium to large website projects

Its MVC Frameworks are:-

Codeigniter, laravel, CakePHP, Symfony, Yii, Zend.

  What is Class?

A PHP class is a group of values with a set of operations to manipulate this values. Classes facilitate modularity and information hiding. Classes are used to define a new data type.

What is Object?

 Object is a compound data type,  Values of more than one types can be stored together in a single variable. Object is an instance of  user defined class.

Rules :

  • A variable starts with the $ sign, followed by the name of the variable.
  • A variable name must start with a letter or the underscore character.
  • A variable name cannot start with a number.
  • It can’t be PHP reserved word.
  • You can’t assign computed value inside a class. ($a = 12+5; )
  • You can’t concatenate in the class.(public $name=”ravi”.”Kumar”;)

Example:-

https://gist.github.com/AvinashKumar33/504957d7954d855c3f86134af10c3915

OUTPUT:-

fun1

Example;-

https://gist.github.com/AvinashKumar33/ef54d82d290a3e705635cfacc5173b6a

OUTPUT:-

Employee Detail

Name : ram
Age : 25
Salary : 20000

Related Posts

Site Reliability Engineering (SRE) Foundation Certification

Introduction to Site Reliability Engineering (SRE) Foundation Certification The Site Reliability Engineering (SRE) Foundation certification is an industry-recognized credential designed to provide students with a comprehensive understanding…

DevOps Foundation Certification

Introduction to DevOps Foundation Certification The DevOps Foundation Certification is a crucial credential designed for individuals looking to master the core principles of DevOps and its practical…

Understanding and Fixing the “Update minSdk Version Error” in Flutter

When working with Flutter, you may occasionally encounter the dreaded “Update minSdk Version Error”. This error typically arises when the Android project within your Flutter app targets…

Medical Tourism in the Digital Era: Top Destinations & the Platforms Powering Global Patient Access

As healthcare grows more expensive and less accessible in many parts of the world, a powerful alternative is rising—medical tourism. From elective cosmetic surgeries to life-saving cardiac…

Understanding and Protecting Against XSS (Cross-Site Scripting) Attacks

Cross-Site Scripting (XSS) remains one of the most common and dangerous security vulnerabilities in web applications. It allows attackers to inject malicious scripts into webpages viewed by…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x