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

  • Home
  • SEARCH
  • 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 8806745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:12:07+00:00 2026-06-14T02:12:07+00:00

So I have a URI that is returned like so /intelliship/ I need the

  • 0

So I have a URI that is returned like so /intelliship/ I need the beginning slash and trailing slash to be removed from that URI.

Attempted (FAILED) code:

<?php 
$value = $_SERVER['REQUEST_URI'];
function __construct($value){
    if(strpos($value,'/')==FALSE){
        return trim(substr(strrchr($value, ' '), 1 ));
    }else{
        return trim(substr($value, strpos($value,'/')),'/');
    }

    $value = ucwords($value);
}
?>

This doesn’t strip any slashes and is pretty sloppy code. Any help would be greatly appreciated.

  • 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-06-14T02:12:09+00:00Added an answer on June 14, 2026 at 2:12 am

    Why not just:

    $value = trim($value, "/");
    

    There is no need for regex or checking what is the first or last character.

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

Sidebar

Related Questions

I'm using an Uri returned from image gallery to create a Bitmap. I have
I would like to get returned value from my webservice. I have my class
I have the following code that retrieves a link to the latest post from
I have: String uri = @drawable/myresource.png; How can I load that in ImageView? this.setImageDrawable?
I currently have a function that grabs the browser windows uri, parses out the
I have a page, URI looks like this: http://domain.example.com/Profiles/Profile.aspx?username=blah#blahtab When that fragment (#blahtab) is
I have an android.net.URI object (of the kind returned by onActivityResult after MediaStore.ACTION_VIDEO_CAPTURE): it
Problem I would like to trace the Uri that will be generated by a
I have a method in codeigniter that looks like this, public function category() {
I have a RESTful API call that acts like this: HTTP GET http://addresss:port/settings/{setting} which

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.