This is my first post so I'm sorry for any mistakes that I may not be aware of.

I've been fidddling with forms and POST for the past days now and I have a curious question on a certain situation.

I have this code in my basic web form. I declared some variables as shown below.

```
<?php
    if (isset($_POST['submit'])) {
    // Form submitted
    $username   = isset($_POST['username'])? $_POST['username']     : "";
    $password   = isset($_POST['password'])? $_POST['password']     : "";
    $email  = isset($_POST['email'])    ? $_POST['email']       : "";
    $country    = isset($_POST['country'])  ? $_POST['country'] : "";
}
?>

```

I wanted to create an array `form_data` with these variables as its elements, so I inserted the following:

```
<?php
    $form_data = array();

    $form_data['username'] = $username;
    $form_data['password'] = $password;
    $form_data['email']    = $email;
    $form_data['country']  = $country;

    print_r($form_data);
?>

```

My question is that is there any method in PHP that I don't know of in where I can get the same result? The variable name will be assigned as a key in the array and I prefer not to type in the keys' names manually like on that bit of code above.

So in short, if I have a variable named `$number`, I want to add its value into an array with 'number'(the variable name) as its key. Is there a method that does this automatically?

I hope I've made this question clear enough.