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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:05:00+00:00 2026-06-08T15:05:00+00:00

http://www.example.com?id=05 or http://www.example.com?id=05&name=johnny This is a string. And I want to get the value

  • 0
http://www.example.com?id=05

or

http://www.example.com?id=05&name=johnny

This is a string. And I want to get the value of $id from it.

What is the correct pattern for it?

  • 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-08T15:05:01+00:00Added an answer on June 8, 2026 at 3:05 pm

    @PhpMyCoder’s solution is perfect. But if you absolutely need to use preg_match (though completely unnecessary in this case)

    $subject = "http://www.mysite.com?id=05&name=johnny";
    $pattern = '/id=[0-9A-Za-z]*/'; //$pattern = '/id=[0-9]*/'; if it is only numeric.
    preg_match($pattern, $subject, $matches);
    print_r($matches);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello i am make like this example which i get from www.xxxxxx.com http://s1172.photobucket.com/albums/r568/novikoraharja/?action=view&current=justanimage.png i
I want to make a rule that transform this URL: http://www.example.com/product.php?category=1&product=5 Into http://www.example.com/brother-2035 (The
I have a URL of form http://www.example.com?foo=one&foo=two I want to get an array of
Is this a valid http url http://www.example.com?x&y or we must always have = sign
I see some URLs like this: http://www.example.com/?view=profile&id=098&hash=589e8bed895198495d987d055699d2b9 Why some sites add ID and hashed
http://www.example.com?a=1&a=2 has a valid form-urlencoded querystring and has two values ( 1 and 2
I have some URLs, like http://www.example.com/something?param1=value1&param2=value2&param3=value3 and I would like to extract the parameters
Example URLs http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I Any regex that will pull the correct YID
if(strpos(http://www.example.com,http://www.)==0){ // do work} I'd expect this to resolve as true, which it does.
I have outbound links like this in my html: <a href=http://www.example.com class=gaLink1 target=_blank onCLick=ga_track_link('action',

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.