Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 643 Bytes

0710.md

File metadata and controls

32 lines (26 loc) · 643 Bytes

What happens if you execute the code below ?

class someclass {
    public $someprop;    
    function __construct() {
        $this->someprop = 1;
    }
}

function somefunc(&$instance) {
    unset($instance);
}

$instance = new someclass();
somefunc($instance);
var_dump($instance);
  • A) object(someclass)#1 (1) { ["someprop"]=> int(1) }
  • B) NULL
  • C) Warning (Only variables can be passed by refence) NULL
  • D) an error
Answer

Answer: A