• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » PHP » What is an Object and class in PHP?
Next →
← Prev

What is an Object and class in PHP?

By Dinesh Thakur

Object: In computer science a primitive data type is a basic type of data provided by programming language. Some examples of primitive data types in PHP include Booleans, which are a logical data type containing true or false; floating-point numbers, also known as floats, which are numeric data type that have fractional values–examples include 36.2 and -25; integers are a numeric data type that hold a whole number without any fractions–examples include -6 and 42; and strings, which contain a sequence of characters such as “ecomputernotes.com.” With that in mind, an object is a complex data structure along with attributes and behaviors.

In contrast with the basic data types, such as a primitive that consists of a single value, an object can have multiple data types, each with their own values.

For example, a string containing the words “Toronto” is a simple data type with a single value.

In comparison, an object representing a physical address may have multiple data types, each with their own values, such as a street number, city, and subdivision.

The value stored for the city could be a string containing the words Toronto. Each value in an object is known as a property, which will be explored in greater depth in a later segment.

Class: A class is a blueprint that defines the attributes and behaviors that makes up an object. Objects are instances of a class, meaning each occurrence of an object of a particular class has all the attributes and behaviors of that class.

The individual attributes will be the same, but the contents of those attributes may differ. Each class modularizes program functions by separating distinct features with as little overlap as possible. Using the example of a physical address again, you can define a class for an address.

The class address has several attributes, like the city and subdivision, and has a behavior of being able to look up a postal code given these attributes; therefore, any object of class address will have those attributes and behavior.

Conceptualize two objects that are instances of an address.

As each object is an address, I know that they should have it least the city and subdivision, so I can look up the postal code. I can’t anticipate the contents of the object attributes, but I do know that they will be in a particular format, and how to access them.

You’ll also like:

  1. Object Oriented Programming in PHP
  2. Defining a class in php
  3. What is the difference between an Object and a Class
  4. Object Class in Java Example
  5. Write A C++ Program To Assign Class Object.
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

PHP Tutorials

PHP Tutorials

  • PHP - Home
  • PHP - Features
  • PHP - Magic Methods
  • PHP - Imagefilter
  • PHP - Arrays Numeric
  • PHP - Sessions
  • PHP - Forms Processing
  • PHP - clone()
  • PHP - Cookies
  • PHP - Variable Types
  • PHP - First program
  • PHP - call()
  • PHP - Iterator interface
  • PHP - Imports files
  • PHP - Exception Handling
  • PHP - set() and get()
  • PHP - Install MAMP
  • PHP - Functions
  • PHP - Constants Types
  • PHP - Comments Types
  • PHP - OOP's
  • PHP - OOps Use
  • PHP - PHP Code & Redirect 301
  • PHP - Control structures
  • PHP - Abstract Classes
  • PHP - Control structures
  • PHP - Classes
  • PHP - MySQL NULL values
  • PHP - Methods Visibility
  • PHP - Operator Types
  • PHP - Short tags Not use
  • PHP - Object and class
  • PHP - Secure Passwords

Other Links

  • PHP - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW