0

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

0

2 Answers 2

5

parse_str

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

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

3 Comments

$urlcode = 'nome=luiz&pais=brasil'; parse_str($urlcode, $output); echo $output['nome'];
Yeah, that function is pretty sweet.
@Luiz, if this is the right answer, which it is, you should click the white checkmark, indicating that it's the right answer.
1

use parse_str(), it does exactly what you want

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

Comments

Your Answer

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