hi everyone,
i got a lil`problem with a function that i wrote. it´s very easy but it´s still not working as it should.
first heres the code and after that i´ll describe the problem.
function parseurl($url)
{
$urlstring = strchr($url, "?");
$urlstring = substr($urlstring, 1);
$dataarray = explode("&", $urlstring);
for ($i=0; $i < $arraycount = count($dataarray); $i++)
{
$variables = explode("=",$dataarray[$i]);
return $$variables[0] = $variables[1];
}
}
$value = "ims/serverdoku/serv.php?item1=value1&item2=value2&item3=value3";
echo $done = parseurl($value);
echo $item1;
echo $item2;
echo $item3;
What i was tryin´ is parsing the given url and create variables out of itself like:
$item1 <--name of the 1st variable
value1 <--value of the 1st variable
$item2 <--name of the 2nd variable
value2 <--value of the 2nd variable
...
It works fine for $item1 but all the other variables are not set.