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.
Use `$_REQUEST['result']`

> 
> [`$_SERVER`](http://php.net/manual/en/reserved.variables.server.php) is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here.
> 
> 
> [`$_REQUEST`](http://www.php.net/manual/en/reserved.variables.request.php) is an associative array that by default contains the contents of `$_GET`, `$_POST` and `$_COOKIE`.
> 
> 
> 

The correct way is to use `$_POST['result']`, as suggested by others here.