Page 1 of 1

$_GET by reference

Posted: Thu Apr 22, 2010 2:32 pm
by Benjamin
What am I missing here? I would have thought this would work fine:

Code: Select all

<?php
$_GET = array('foo' => 'foo', 'bar' => 'bar');

class referenceTest {
    private $get = array();

    public function __construct() {
        $this->get &= $_GET;
        unset($this->get['foo']);
    }
}

$n = new referenceTest();

echo '<pre>' . print_r($_GET, true) . '</pre>';
Outputs:
Array
(
[foo] => foo
[bar] => bar
)

Re: $_GET by reference

Posted: Thu Apr 22, 2010 2:39 pm
by Benjamin
My bad, &= should be =&.