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 3495756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:09:56+00:00 2026-05-18T12:09:56+00:00

I am still learning php. ‘SCRIPT_FILENAME’ => string ‘D:/Project Storage/wnmp/www/folder/index.php’ (length=45) ‘SCRIPT_NAME’ => string

  • 0

I am still learning php.

'SCRIPT_FILENAME' => string 'D:/Project Storage/wnmp/www/folder/index.php' (length=45)
'SCRIPT_NAME'     => string '/folder/index.php' (length=18)
'DOCUMENT_URI'    => string '/folder/index.php' (length=18)
'PHP_SELF'        => string '/folder/index.php' (length=18)
'REQUEST_URI'     => string '/folder/helloworld/helloworldtwo/etc' (length=15)

as you can see i just want to get the helloworld/helloworldtwo/etc

any idea to extract the folder ? so it will be helloworld/helloworldtwo/etc ?

what im thinking is im defining my folder like $root = 'folder'. then i extract it if it match, but the problem is with what ?

the second idea is to get from php_self or anything above to get the first from /first/second.php,
but again i dont know the best way to do it.

and another problem is when we have like two folders in the front ? btw thanks for all of the replay, im still doing some read php.net, test, and try.

'SCRIPT_FILENAME' => string 'D:/Project Storage/wnmp/www/folder/index.php' (length=45)
'SCRIPT_NAME'     => string '/folder/folder2/index.php' (length=18)
'DOCUMENT_URI'    => string '/folder/folder2/index.php' (length=18)
'PHP_SELF'        => string '/folder/folder2/index.php' (length=18)
'REQUEST_URI'     => string '/folder/folder2/helloworld/helloworldtwo/etc' (length=15)

the question is still the same how can i get the helloworld/hellowrodltwo/etc the right way.

edit*
guys thanks a lot i have made a solution

$str = 'folder/folder/helloworld/helloworldtwo/etc';
$folder = 'folder/folder';
$q = str_replace($folder, NULL, $str);
echo $q;

but if there is anything / alternative or a better way to do it please do.

Thanks again.

  • 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-18T12:09:57+00:00Added an answer on May 18, 2026 at 12:09 pm

    You can use the explode function in PHP

    $str = 'folder/helloworld/helloworldtwo/etc';
    
    print_r(explode('/', $str, 2));
    

    The output will be:

    Array
    (
        [0] => folder
        [1] => helloworld/helloworldtwo/etc
    )
    

    If you have multiple folder/ you can do use ‘folder/’ as the delimiter and don’t impose a limit

    $str = 'folder/folder/helloworld/helloworldtwo/etc';
    
    print_r(explode('folder/', $str));
    

    The output will be:

    array (
      0 => '',
      1 => '',
      2 => 'helloworld/helloworldtwo/etc',
    )
    

    then you can use the implode function to join it back into a string

    $returnValue = implode('', array (
      0 => '',
      1 => '',
      2 => 'helloworld/helloworldtwo/etc',
    ));
    

    Joining this 2 functions you can remove how many folders you want from the url and have the clean url at the end in a string

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still learning the ropes with PHP & MySQL and I know I'm doing
I am not an expert in PHP, still learning it. I'd like some hints
Okay I'm still learning the ropes with the Entity Framework and I came across
Forgive my ignorance - still learning here. I am using Eclipse Ganymede (Java 1.5)
I'm still learning Grails and seem to have hit a stumbling block. Here are
I'm still learning ASP.NET and I often see code like this throughout parts of
I'm still learning the dark arts of TDD and recently I've been trying to
I'm still learning about REST and, in my test, came up with this scenario
I am a C# developer. Still learning. I had not learn all the features
This is going to sound like a silly question, but I'm still learning C,

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.