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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:58:13+00:00 2026-06-02T19:58:13+00:00

I have few functions that sanitize everything in get and post but this one

  • 0

I have few functions that sanitize everything in get and post but this one must be bit more specific , I have an array that is producing links like

array(
  1 => http://site/something/another/?get_something=1
  2 => http://site/something/another2/?get_something=1
)

also have a function that is sanitizing get and post but that function would clear everything from this array values so I am left with

httpsitesomethinganotherget_something1

can someone please help to match EVERYTHING after get_something=
and clear it or replace it with get_something=1 , something like

$clear = preg_match('/^[A-Za-z0-9]+$/', $array[1]);
preg_replace("/get_something=".$clear."/i","",$array[1]);
  • 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-02T19:58:14+00:00Added an answer on June 2, 2026 at 7:58 pm

    You should use parse_url but here is a regex implementation, in case you’re curious:

    $urls = array
    (
        'http://site/something/another/?get_something=1',
        'http://site/something/another2/?get_something=1',
        'http://site/something/another/?get_something=1&foo=bar',
        'http://site/something/another/?foo=bar&get_something=1',
    );
    
    $urls = preg_replace('~[?&]get_something=.*$~i', '', $urls);
    
    print_r($urls);
    

    Should output (demo [updated]):

    Array
    (
        [0] => http://site/something/another/
        [1] => http://site/something/another2/
        [2] => http://site/something/another/
        [3] => http://site/something/another/?foo=bar
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few JavaScript functions that all look similar to me. but behave
Basically I have a few functions that look like this: class MyClass { void
I have created a few utility functions like one h() that acts as echo
I have a few functions that return a 1 if an error is encountered.
I have a fairly simple python loop that calls a few functions, and writes
I have some python modules containing mostly functions and a few classes. Each one
I have to modify a few tables in one function. They must all succeed,
I have a few JavaScript functions that behave as event listeners for an <object/>
I have a few functions that I'm using to draw different type of text.
I'm having a bit of a jQuery problem. Basically I have some functions that

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.