Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7698511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:15:34+00:00 2026-05-31T22:15:34+00:00

I have read plenty of C# examples of Value Objects, and I understand that

  • 0

I have read plenty of C# examples of Value Objects, and I understand that it is an “object” that is identified by it’s values. If a value changes, the object is “new”.

However, that doesn’t seem to make sense when it comes to PHP…either that, or I’m just not making the connection.

Is a Value Object just a string?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:15:35+00:00Added an answer on May 31, 2026 at 10:15 pm

    To put this into context, in many OO languages, objects are compared by their identity. In pseudocode:

    bar = new Foo
    baz = new Foo
    
    bar == baz  // false
    

    Even though both objects are basically the same if you just look at their values, they’re not considered to be identical, because they are separate instances. To demonstrate:

    bar = new Foo
    baz = bar
    
    bar == baz  // true
    

    Now:

    In computer science, a value object is a small simple object, like money or a date range, whose equality isn’t based on identity.

    http://en.wikipedia.org/wiki/Value_object

    This would be a demonstration of "value objects":

    address1 = new Address('Main street 42')
    address2 = new Address('Main street 42')
    
    address1 == address2  // true
    

    Because the values are the same, both objects are considered equal, even if they’re separate instances.

    PHP does not have a separate concept of "value objects", it only has one type of object. Its comparison operator can make that distinction though:

    When using the comparison operator (==), object variables are compared in a simple manner, namely: Two object instances are equal if they have the same attributes and values, and are instances of the same class.

    http://www.php.net/manual/en/language.oop5.object-comparison.php

    E.g.:

    $address1 = new Address('Main street 42');
    $address2 = new Address('Main street 42');
    
    $address1 == $address2;  // true     equal...
    $address1 === $address2;  // false   ...but not identical
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know system.exit(0) should not be used. I have read plenty of tutorials as
I have read plenty of blog posts and have yet to find a clear
In the past few years I have read plenty of articles on Foreign Keys
I have read plenty of things on the topic, how telnet is a protocol,
I know that there have been plenty of topics describing this topic but I
I've read plenty of questions and articles stating that converting from ASP.NET Webforms to
I have read plenty of blogs and tutorials on how to create and use
I'm sorry if this is a weird question. I have read plenty of stuff
I have read plenty of ways of removing the comma at the end of
Im currently creating my own forum for my website and i have read plenty

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.