How to extract specific variables from a string?
Posted
by David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2010-04-29T01:30:44Z
Indexed on
2010/04/29
1:37 UTC
Read the original article
Hit count: 555
Hi, let's say i have the following:
$vars="name=david&age=26&sport=soccer&birth=1984";
I want to turn this into real php variables but not everything. By example, the functions that i need :
$thename=getvar($vars,"name");
$theage=getvar($vars,"age");
$newvars=cleanup($vars,"name,age"); // Output $vars="name=david&age=26"
How can i get only the variables that i need . And how i clean up the $vars from the other variables if possible?
Thanks
© Stack Overflow or respective owner