Author Topic: In PHP, objects are they passed by value or by reference?  (Read 52 times)

thejewelrysource

  • Hero Member
  • *****
  • Posts: 1184
  • Welcome to Digital Marketing Forum!
    • View Profile
In PHP, objects are they passed by value or by reference?
« on: September 05, 2021, 01:38:12 pm »
In PHP, objects are they passed by value or by reference?

Makoo

  • Hero Member
  • *****
  • Posts: 725
  • Welcome to Digital Marketing Forum!
    • View Profile
This is probably the most misunderstood PHP concept for people coming from other languages. A reference and a value are two completely different things. A reference is a memory address. A value can be of any type. Using the same terminology as we use for different types of pointers in C, here is how to distinguish between a reference and a value: -A ___ reference to an object is just a memory address (int). -A ___ object's value can be of any type (string, array, boolean, resource, etc.).

 

Digital Marketing Forum is a do-follow forum, post and discuss IT topics here and get dofollow signature. Discuss about SEO, SMO, Directory Submission, 301 redirection, robots, social bookmarking, Web design and development.