3

Suppose if I have string like this:

rajeshpatel&rid=10&sid=20&mid=30

Then how can I get value of "rid" using php.

any help?

1
  • 1
    two upvote on this question?interesting. Commented Jul 4, 2015 at 7:50

1 Answer 1

1

You can use parse_str as

$str = 'rajeshpatel&rid=10&sid=20&mid=30';
parse_str($str,$result);
print_r($result);
echo $result['rid'];//10

Or you can use it in another way as

parse_str($str);
echo $rid;//10

Fiddle

Sign up to request clarification or add additional context in comments.

1 Comment

Glad to help. Please don't call me sir. And that's why SO is created for

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.