Elance Exams Answers PDF file

-- PDF FILE --
Download PDF file of elance Zoho Creator Exam Answers

What is wrong with the following code? <?php function duplicate($obj) { $newObj = $obj; return $newObj; } $a = new MyClass(); $a_copy = duplicate($a); $a->setValue(10); $a_copy->setValue(20); ?>

There is nothing wrong with this code
You must use return &$newObj instead
duplicate() must return a reference
You must use the clone operator to make a copy of an object
  • Follows us our servcies
  • Facebook icon
  • Linkedin icon
  • twitter icon
  • rss icon
  • social icon