tags:

views:

40

answers:

3

Hello everybody, I hope you can help me;

How to convert a urlcode in array in php?

example:

$Urlcode = 'name=luiz&country=Brazil&city=patrociniomg';

I need to transform this $Urlcode in array, in PHP, anyone know?

Thanks to everyone now

+5  A: 

parse_str

http://www.php.net/manual/en/function.parse-str.php

Jason McCreary
$urlcode = 'nome=luizparse_str($urlcode, $output);echo $output['nome'];
luiz henrique
thanksssssssss, very nice
luiz henrique
Yeah, that function is pretty sweet.
Jason McCreary
@Luiz, if this is the right answer, which it is, you should click the white checkmark, indicating that it's the right answer.
Mike Sherov
A: 

(edit: removed my answer, it was stupid)

Jules
This won't decode the strings. It works for the trivial example given only because those strings contain no non-letter characters.
thomasrutter
+2  A: 

use parse_str(), it does exactly what you want

http://www.php.net/manual/en/function.parse-str.php

PeterWong