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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:24:25+00:00 2026-05-23T18:24:25+00:00

So I am triing to read some php code… I found such line $uri

  • 0

So I am triing to read some php code… I found such line

$uri = rtrim(preg_replace('#((?<=\?)|&)openid\.[^&]+#', '', $_SERVER['REQUEST_URI']), '?');

what does it mean? and if it (seems for me) just returns ‘file name’ why it is so complicated?

  • 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-23T18:24:26+00:00Added an answer on May 23, 2026 at 6:24 pm

    The purpose of that line is to remove values like openid.something=value from the request URI.

    There are tools out there to translate regex into prose, with an aim to help you understand what a regex is trying to match. For example, when yours is passed to such a tool the description comes back as:

    NODE                     EXPLANATION
    --------------------------------------------------------------------------------
      (                        group and capture to \1:
    --------------------------------------------------------------------------------
        (?<=                     look behind to see if there is:
    --------------------------------------------------------------------------------
          \?                       '?'
    --------------------------------------------------------------------------------
        )                        end of look-behind
    --------------------------------------------------------------------------------
       |                        OR
    --------------------------------------------------------------------------------
        &                        '&'
    --------------------------------------------------------------------------------
      )                        end of \1
    --------------------------------------------------------------------------------
      openid                   'openid'
    --------------------------------------------------------------------------------
      \.                       '.'
    --------------------------------------------------------------------------------
      [^&]+                    any character except: '&' (1 or more times
                               (matching the most amount possible))
    

    As the above says, the regex looks for a ? or & followed by openid., followed by anything not &. The resulting match will include the preceeding & if there is one, but not the ? since a look behind was used for the latter.

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

Sidebar

Related Questions

I am trying to read some settings from php.ini using zend. The API that
I am trying to read some smps files with python, and found a fortran
I'm trying to use some off-the-shelf PHP code in RHEL5 which requires the sqlite
I'm struggling trying to read a php file inside a php and do some
I am trying to code an simple PHP application which will retrieve some information
I've read some posts about namespaces and autoload in php 5.3+, but still haven't
I have some java code that work on the command line, and need to
I'm trying to read some OpenGL tutorials on the net. the problem is that
I am trying to read some info from a text file by using windows
I'm getting something pretty strange going on when trying to read some data using

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.