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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:04:15+00:00 2026-06-12T16:04:15+00:00

This is probably simple however I am not the best with expressions.. I am

  • 0

This is probably simple however I am not the best with expressions..
I am trying to get the following string from..

http://www.yoursite.com/offers/838?&SITEID=2172

to this.. using an expression that will remove the ?&SITEID and the dynamic id which will vary

http://www.yoursite.com/offers/838  

Can anyone suggest the best/simplest method to do this?

  • 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-12T16:04:17+00:00Added an answer on June 12, 2026 at 4:04 pm

    Check this function:

    $str = 'http://www.yoursite.com/offers/838?&SITEID=2172';
    
    function remove_query_arg($var, $url = NULL){
        if(!$url){
            $url = $_SERVER['REQUEST_URI'];
        }
        $parsed_url = parse_url($url);
    
        $query_vars = explode('&', $parsed_url['query']);
    
    
        foreach($query_vars as $key => $value){
            $query_vars[$key] = explode('=', $query_vars[$key]);
            $query_variables[$query_vars[$key][0]] = $query_vars[$key][1];
        }
    
        if(is_array($var)){
            foreach($var as $value){
                unset($query_variables[$value]);
            }
        }
        elseif(is_string($var)){
            unset($query_variables[$var]);
        }
    
        $query_vars = array();
    
        foreach($query_variables as $key => $value){
            $query_vars[] = $key.($value !== NULL || !empty($value) ? '='.$value : '');
        }
        $query_str = '';
        $query_str = implode('&',$query_vars);
    
        return (isset($parsed_url['scheme']) && !empty($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : '').$parsed_url['host'].(isset($parsed_url['path']) && !empty($parsed_url['path']) ? $parsed_url['path'] : '').(!empty($query_str) ? '?'.$query_str : '');
    }
    
    echo remove_query_arg('SITEID', $str);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

probably a simple question however I am not the best at PHP. I'll show
This is probably something really simple, however I am quite new to PHP, and
I know this probably really simple but Im not sure what im doing wrong...
This is probably best explained through some code. I know that in the following
this is probably quite a simple problem, however, I can't figure out how to
This is probably a simple question ( or I assume to be ) however,
This is probably a simple thing. I'm trying to draw my first shapes in
This is probably a silly question however, is there a simple way of doing
This is probably a simple misunderstanding on my part. Have a simple interface: public
This is probably a simple question but I can't seem to figure out how

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.