0

This is the value i get from db.

pkid=1&ordernumber=54322&ordervalue=12345&response=2&scheduleId=1

Want to extract response from this.That is 2.

Bugfixer
  • 2,547
  • 2
  • 26
  • 42

1 Answers1

1

Here it is

$str ='pkid=1&ordernumber=54322&ordervalue=12345&response=2&scheduleId=1';
parse_str($str);
echo $response; // output :- 2
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
Samir Das
  • 1,878
  • 12
  • 20
  • I didn't downvote, but probably because 1. This doesn't work correctly (You have to echo `$str['response']`, not `$resposne`). 2. The op didn't try anything himself and just wants a solution. Giving them an answer makes you look like a repwh ... well, someone who just wants reputation. People don't like that. – Realitätsverlust Jun 11 '15 at 06:24
  • Alright nvm, that works, forgot that parse_str() creates variables too ._. – Realitätsverlust Jun 11 '15 at 06:25
  • @YUNOWORK your point 2 is not correct at all. If same question would answer who have 100K reputation, you guys give up vote. Reputation really matters. Anyway thanks for the advice – Samir Das Jun 11 '15 at 06:41
  • @YUNOWORK- I tried to find a solution on stackoverflow but i got nothing.i was searching by the same headline "I want to extract the number by key from a query string". – Bugfixer Jun 11 '15 at 06:50