It has nothing to do with function parameters. PHP 5 has only pointers to objects; it does not have “objects” as values. So your code is equivalent to this in C ++:
MyDocumentHTMLDom *dom = new MyDocumentHTMLDom; myFun(dom);
Now many of the people mentioned go by value or follow the link. You did not ask about this in the question, but since people mention it, I will talk about it. As in C ++ (since you mentioned that you know C ++), passing a value or passing by reference is determined by how the function is declared.
A parameter is passed by reference if and only if the function declaration contains & :
function myFun(&$dom) { ... }
as in C ++:
void myFun(MyDocumentHTMLDom *&dom) { ... }
If this is not the case, then this is a pass by value:
function myFun($dom) { ... }
as in C ++:
void myFun(MyDocumentHTMLDom *dom) { ... }
source share