Reference problem when returning an object from array in PHP
- by avastreg
I've a reference problem; the example should be more descriptive than me :P
I have a class that has an array of objects and retrieve them through a key (string), like an associative array:
class Collection {
public $elements;
function __construct() {
$this->elements = array();
}
public function get_element($key) {
…