how to create php keys from an arrays values?
<p>I have an array like so:</p>

<pre><code>$input = array("visit", "outdoor", "parks-trailer");
$input_content = "A Value for last array element for input array."

$another_input = array("visit", "outdoor");
$another_input_content = "A Value for last array element for $input_content array."
</code></pre>

<p>And I have some text to assign to the last element of the array, once built.</p>

<p>Basically, what I need is the returned array to be like this:</p>

<pre><code>$output = array(
    "visit" =&gt; array(
        "outdoor" =&gt; array(
            "A Value for last array element for $input_content array."
            "parks-trailer" =&gt; "A Value for last array element for input array."
        )
    )
);
</code></pre>

<p>How can I do this from values of an $input array that will always be 1 dimensional.</p>

<pre><code>$content = 'My Value';
$output = array();
$flipped = array_flip($input);
$count = count($input) - 1;

foreach($flipped as $key =&gt; $flip)
{
    if ($count &gt;= $key)
        $output[$key] = $content;
    else
        $output[$key] = array();
}
</code></pre>

<p>The problem here is that array_flip does work, but it doesn't do multidimensional here?  And so array_flip transforms to <code>array('visit' =&gt; 0, 'outdoor' =&gt; 1, 'parks-trailer' =&gt; 2)</code>, but I'm at a loss on how to get it to do multidimensional array, not singular.</p>

<p><strong>I need to loop through multiples of these and somehow merge them into a global array, the answer given in here is not the same.</strong></p>

<p>So, I need to merge each 1 of these into another array, keeping the values, if they exist.  <code>array_merge</code> does not keep the values, <code>array_merge_recursive</code> does not keep the same key structure.  How to do this?</p>