Breadcrumbs

This one had me stumped!!

Working with arrays is something that every developer has to be comfortable with. Fortunately PHP has mountains of array functions to offer.

Consider the following data:

Keeping in mind that the $categories can be nested any number of levels deep, write a script/function/class that can find a category by name and return its hierarchy in a folders like fashion.

For example searching for ‘Granny Smith’, the script would return ‘Fruit/Apples/Granny Smith’.

 

Leave a Reply