2
I have this code where I get the value of a post and ajax.
$string = 'nome=Alexandre+Sousa&cpf=0000000000000&email=sousa.akira%40gmail.com&site=www.uniaomaker.com.br';
$dados = explode('&',$string);
$total = count($dados);
$array = '';
foreach ($dados as $list) {
$vals = explode('=',$list);
$array .= '"'.$vals[0].'"'. '=>'.'"'.$vals[1].'"'.',';
}
$keys = array($array);
echo '<pre>';
print_r($keys);
The result I get and the following
Array ( [0] => "name"=>"Alexandre+Sousa","Cpf"=>"0000000000000","email"=>"Sousa.Akira%40gmail.com","site"=>"www.uniaomaker.com.br", )
But I need the array to return this way
Array ( [name] => Alexandre+Sousa [Cpf] => 0000000000000 [email] => Sousa.Akira%40gmail.com [site] => www.uniaomaker.com.br )
I have tried many tips but could not find solution,
You are returning an array within another array, to return what you need, you should return each element as a position of the array
– MarceloBoni
could give me a hand with the code?
– Alexandre Sousa