PHP > Returning allowed paths : <p><em>I already asked this question but it was published a little confusing and therefore proberbly not answered. So I try again with an extra example, if it's fine.</em></p>

<p>There are original array's with url's like the one in example 1 and 2.
Every <strong>last</strong> folder of each element of the original array is the folder where some user has the right to view.</p>

<p><strong>Example 1</strong></p>

<pre><code>Array(
'a'
'a/b/c'
'a/b/c/d/e'
'a/y'
'b/z'
'b/z/q
)
</code></pre>

<p>I would like to get a two array's like:</p>

<pre><code>Array['short'](
'a/c/e'
'a/y'
'z/q'
)

Array['full'](
'a/b/c/d/e'
'a/y'
'b/z/q'
)
</code></pre>

<p><strong>Example 2</strong> </p>

<pre><code>Array(
'projects/projectA/books'
'projects/projectA/books/cooking/book1'
'projects/projectA/walls/wall'
'projects/projectX/walls/wall'
'projects/projectZ/'
'projects/projectZ/Wood/Cheese/Bacon'
)
</code></pre>

<p>I would like to get a two array's like:</p>

<pre><code>Array['short'](
'books/book1'
'wall'
'wall'
'projectZ/Bacon'
)

Array['full'](
'projects/projectA/books/cooking/book1'
'projects/projectA/walls/wall'
'projects/projectX/walls/wall'
'projects/projectZ/Wood/Cheese/Bacon'
)
</code></pre>
