Answer the question
In order to leave comments, you need to log in
How are objects passed in PHP by reference or by value?
Hello. I decided to take the PHP test and was surprised by the results. I kept thinking that objects are passed by reference, but in the test the answer is different. Here's a picture
And taking this opportunity, another question related to multi-inheritance. Does PHP still support it or not? In other words, when asking such a question, do they mean traits or not?
Answer the question
In order to leave comments, you need to log in
in php4 objects were passed by value, in php5 they were passed by reference, hence the confusion.
There is no multiple inheritance in php (a class can only extend 1 class). Traits are a little different.
I kept thinking that objects are passed by reference, but in the test the answer is different.
And taking this opportunity, one more question related to multi-inheritance. Does PHP still support it or not? In other words, when asking such a question, do they mean traits or not?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question