in teoria potresti fare anche così
evitanto sicuramente errori di accesso alla memoria
Codice PHP:
$stringa="";
for($i=0;$i<count($array);$i++)
{
if($i%2==0)
{
$stringa.="myarray[].elementid=";
}
else
{
$stringa.="myarray[].req=";
}
$stringa.=$array[$i]."&";
}
$stringa=substr($stringa, 0, -1);
echo $stringa;