Class

In Object-Oriented Programming, a class is a blueprint that defines the functions and variables which are common to objects of a certain kind.

Object

In OOPS an object is a specimen of the class. It is nothing but a component that consists of methods and properties which make the data useful and help users to determine the behavior of the class.

lead interview questions
Let’s understand this with an example
BY Best Interview Question ON 03 Nov 2021

Example

class Person{

    public $name;

    function __construct($name){

        $this->name = $name;

    }

    function getUserDetails(){

        return "My name is ".$this->name;

    }

}