Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6546807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:45:14+00:00 2026-05-25T11:45:14+00:00

I got directory array below. I will make a file search in this array.

  • 0

I got directory array below.

I will make a file search in this array. For example path.php , survey.php…
If file is found , how should a construct the path.

for path.php

I want function to return ‘/survey/config/path.php’

Array
(
[survey] => Array
    (
        [config] => Array
            (
                [0] => path.php
                [1] => routes.php
            )

        [controllers] => Array
            (
                [0] => admin.php
                [1] => giris.php
            )

        [models] => Array
            (
                [0] => giris.php
            )

        [views] => Array
            (
                [0] => admin_form.php
                [1] => widget.php
                [2] => yeni_form.php
            )

        [widgets] => Array
            (
                [0] => survey.php
            )

    )

)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:45:14+00:00Added an answer on May 25, 2026 at 11:45 am
    function find_file_path($dir_structure, $filename) {
        foreach($dir_structure as $dir => $subpath) {
            if(is_array($subpath)) {
                $sub_found = find_file_path($subpath, $filename);
                if($sub_found) {
                    return "/" . $dir . $sub_found;
                }
            } else {
                if($subpath === $filename) {
                    return "/$filename";
                }
            }
        }
        return FALSE;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Follow up to this question about GNU make : I've got a directory, flac
I've got the php list directory script from this link http://www.gaijin.at/en/scrphpfilelist.php . How do
I've got a small php script that will gather all files in a directory.
I haw got a array of directory's that i wont to use for the
Huge fan of this website, but it's my first post! I've got an array
I've got a directory location, how can I create all the directories? e.g. C:\Match\Upload
Greetings, I've got a directory with a list of pdfs in it: file1.pdf, file2.pdf,
I've got a whole directory of dll's I need to register to the GAC.
I've got an Active Directory synchronization tool (.NET 2.0 / C#) written as a
I've got a junk directory where I toss downloads, one-off projects, email drafts, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.