Question: Is it possible to access a sub-property of an object dynamically? I managed it to access the properties of an object, but not the properties of a sub-object.

Here is an example of the things I want to do:

```
class SubTest
{
    public $age;

    public function __construct($age)
    {
        $this->age = $age;
    }
}

class Test
{
    public $name;
    public $sub;

    public function __construct($name, $age)
    {
        $this->name = $name;
        $this->sub = new SubTest($age);
    }
}

$test = new Test("Mike", 43);

// NOTE works fine
$access_property1 = "name";
echo $test->$access_property1;

// NOTE doesn't work, returns null
$access_property2 = "sub->age";
echo $test->$access_property2;

```

Answer: 
`$_SERVER` contains server variables, that is, things like the operating system, the referrer URL, paths to various folders on the server.

What you're looking for instead is either the `$_POST` array, the `$_GET` array, or the `$_REQUEST` array. I might be stating the obvious here, but here's what they contain:

* `$_POST` contains a list of all variables POSTed to the script.
* `$_GET` contains a list of all variables in the query string (eg: `someScript.php?x=1&y=2`)
* `$_REQUEST` contains a merge of `$_POST`, `$_GET` and `$_COOKIE` (usually in that order). I don't recommend using this: you should *know* the methods you're using to get variables into your script and use that array specifically.

In your case, you need to take a look at the `$_POST` array. It's always handy to run this once:

```
print_r($_POST);

```

This will show you everything posted to that page.
The jQuery $.post function sends a post request to the server, which means to access the value of "result", you need to get it from the $\_POST superglobal.

Try $\_POST['result'] instead of $\_SERVER['result'].

These descriptions may help (source: <http://www.nusphere.com/php/php_superglobals.htm>):

* **$\_POST**- The $\_POST Superglobal represents data sent to the PHP
script via HTTP POST. This is
normally a form with a method of
POST.
* **$\_SERVER**- The $\_SERVER Superglobal represents data available
to a PHP script from the Web server
itself (not what you're looking for)
* **$\_REQUEST**- The $\_REQUEST Superglobal is a combination of
$\_GET, $\_POST, and $\_COOKIE (would
work, but why search GET and COOKIE
when you know the value is in POST?)