In PHP, are objects passed by value or by reference?
- By value
- By reference
- Depends on the scenario
- Both options are valid
In PHP, objects are passed by value. When you assign or pass an object to a variable or a function, a copy of the object is created. Learn more: http://php.net/manual/en/language.oop5.references.php
Loading...
Related Quiz
- A constructor in a PHP class is defined using the __construct() method.
- Which PHP function is used to check if a variable is of a specified type?
- How can you call a user-defined function in PHP using a string variable?
- In PHP, $_SERVER is a superglobal array that contains information such as headers, paths, and ______ locations.
- What is the difference between $_FILES['userfile']['name'] and $_FILES['userfile']['tmp_name']?