Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove object pass by reference #15

Merged
merged 1 commit into from
May 1, 2013
Merged

Remove object pass by reference #15

merged 1 commit into from
May 1, 2013

Conversation

coenjacobs
Copy link
Contributor

This document, oversimplified explained: Passing objects by reference is no longer needed.

One of the key-points of PHP5 OOP that is often mentioned is that "objects are passed by references by default". This is not completely true. This section rectifies that general thought using some examples.

A PHP reference is an alias, which allows two different variables to write to the same value. As of PHP5, an object variable doesn't contain the object itself as value anymore. It only contains an object identifier which allows object accessors to find the actual object. When an object is sent by argument, returned or assigned to another variable, the different variables are not aliases: they hold a copy of the identifier, which points to the same object.

mattyza added a commit that referenced this pull request May 1, 2013
@mattyza mattyza merged commit e0eb69b into woocommerce:develop May 1, 2013
@coenjacobs coenjacobs deleted the remove-object-pass-by-reference branch May 1, 2013 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants