preg_match pattern problem
Posted: Fri Oct 03, 2008 5:16 am
I have a string that looks like this:
(asfd=asdf,qwer=qwew,ery=errtui)
and I want to store all value=value in an array using pregmatch like so:
preg_match($pattern,$string,$array);
what pattern could I use??
I tried '/(\w+)=(\w+)/' but that only returns:
Array
(
[0] => ery=errtui
[1] => ery
[2] => errtui
)
but I would like to get:
Array
(
[0] =>{
[0] => asfd=asdf
[1] => asfd
[2] => asdf
}
[1] =>{
[0] => qwer=qwew
[1] => qwer
[2] => qwew
}
[2] =>{
[0] => ery=errtui
[1] => ery
[2] => errtui
}
)
please help... THANX
(asfd=asdf,qwer=qwew,ery=errtui)
and I want to store all value=value in an array using pregmatch like so:
preg_match($pattern,$string,$array);
what pattern could I use??
I tried '/(\w+)=(\w+)/' but that only returns:
Array
(
[0] => ery=errtui
[1] => ery
[2] => errtui
)
but I would like to get:
Array
(
[0] =>{
[0] => asfd=asdf
[1] => asfd
[2] => asdf
}
[1] =>{
[0] => qwer=qwew
[1] => qwer
[2] => qwew
}
[2] =>{
[0] => ery=errtui
[1] => ery
[2] => errtui
}
)
please help... THANX