21
Hi Stefano,
thanks for visiting my website
Try this code for your problem:
$countries = 'a:2:{s:5:"milan";s:6:"Milano";s:6:"naples";s:6:"Napoli";}';
$token = strtok($countries,';:');
$q=1;
while ($token) {
if (substr($token,0,1) == '"') {
echo $q," ",$token," ",substr($token,1,-1);
if ($q % 2 !=0)
{
echo " -> number is odd";
$country[$q]['id'] = substr($token,1,-1);
}
else
{
echo " -> number is even";
$country[$q-1]['name'] = substr($token,1,-1);
}
$q++;
echo "
";
}
$token = strtok(';:');
}
echo "
";
echo";
foreach (array_keys($country) as $j) {
$country_id = $country[$j]['id'];
$country_name = $country[$j]['name'];
echo"n";
}
echo"";
arrivederci,
Marco
--
Match Dart!Darts Ranking, News, Videos, Forum and more