Are Php function parameters passed as references to object or as copy of object?
It's very clear in C++ but in Php5 I don't know.
Example:
<?php
$dom = new MyDocumentHTMLDom();
myFun($dom);
Is parameter $dom
passed as a reference or as a copy?
In PHP5, objects are passed by reference. Well, not exactly in technical way, because it's a copy - but object variables in PHP5 are storing object IDENTIFIER, not the object itself, so essentially it's the same as passing by reference.
More here: http://www.php.net/manual/en/language.oop5.references.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With