If somebody provided a better solution then what you asked for, you are like most users on any helpdesk: You dont ask for help with your problem, but you ask how to implement what you think is the solution.
I see it all the time on SO and any other forum/helpdesk I have visited and unfortunately it mainly involves the none lazy people. They did try to find a solution for their problem themself as requested/advised by SO, but they are only searching for solutions within the scope of their knowledge. And then after a few hours of messing around in copy/pasted code they ask help to implement their solution, without mentioning the actual problem.
Example PHP Problem (simplefied):
How can i parse the following string to a key/value array?
"key1=val1&key2=val2&key3=val3&key4"
Solution tried:
Explode (split) on &
Loop the resulting array and explode each value on =
save the results to an array
<?php
$str = "key1=val1&key2=val2&key3=val3&key4";
$ar1 = explode(";", $str);
for ($i=0;$i<count($ar1);$i++) {
$ar2 = explode("=", $ar1[$i]);
$result[$ar2[0]] = $ar2[1]; //error for key 4 since there is no =
}
?>
Question asked:
Why do I get a warning that an index is undefined
Awnser:
You should use array_key_exists
Now the question is answered, since there wont be a warning any more. But if he actually asked for a solution to his problem the answer would be:
use parse_str($str, $result);