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

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

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

How to Debug Apache Errors Using Log Files in XAMPP (Linux)

When working with web servers like Apache, errors can sometimes be tricky to figure out. Fortunately, Apache provides detailed log files that can help you identify what’s…

How to Resolve Laravel Dusk Installation Issues: Missing ext-zip and PHP Compatibility

Laravel Dusk is a powerful browser automation and testing tool that allows you to test the front-end of your Laravel application in real-time. However, if you’re encountering…

Testing the Capabilities of Your Laravel Application: Tools and Software to Use

As a developer working with Laravel, ensuring that your application performs efficiently, scales well, and provides a seamless experience for users is crucial. Whether you’re building a…

Implementing Retry Logic with Exponential Backoff

In modern web applications, API calls and network requests play a crucial role in retrieving data or interacting with external services. However, one common challenge developers face…

How to Resolve the “429 Too Many Requests” Error

The 429 Too Many Requests error occurs when a server is overwhelmed by too many requests in a short period. It’s a common issue when interacting with…

Best Tech websites in the world in 2025

AIOps School AIOps School is a learning platform focused on AI-powered IT operations (AIOps) and Machine Learning Ops (MLOps). Branded as the “Gateway to AI-Powered IT &…

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