Printing all possibilities of leaf elements of 3-D array in PHP
<p>I have an issue and trying to solve in php. I need ideas of yours for solving this issue. 
I'm gonna try to explain, hope I can.</p>

<p>I have an array like this:</p>

<pre><code>$mainArr = array(array("a","b","c"),array("1","2","3"),array("x","y","z"));
Array
(
    [0] =&gt; Array
        (
            [0] =&gt; a
            [1] =&gt; b
            [2] =&gt; c
        )

    [1] =&gt; Array
        (
            [0] =&gt; 1
            [1] =&gt; 2
            [2] =&gt; 3
        )

    [2] =&gt; Array
        (
            [0] =&gt; x
            [1] =&gt; y
            [2] =&gt; z
        )

)
</code></pre>

<p>What I'm trying to do is printing all 3 possibilities of leaf elements. Like that:</p>

<pre><code>a1x
a1y
a1z

a2x
a2y
a2z

a3x
a3y
a3z

b1x
b1y
b1z

.
.
.
</code></pre>

<p>I try to form an algorithm to make this, but I got stuck.</p>

<p>Can you please help me for this issue?</p>

<p>Thanks in advance </p>
