Hello,
I'm trying to use sscanf, but I'm not receiving the results I expected! Can
anybody help me, please?
Thanking in advance,
Nuno Lopes
/************************************************/
<?
$db='"33996344","33996351","GB","GBR","UNITED KINGDOM"
"50331648","83886079","US","USA","UNITED STATES"
"94585424","94585439","SE","SWE","SWEDEN"';
$lines=explode("\n", $db);
foreach ($lines as $line) {
$array=sscanf($line, "\"%010d\",\"%010d\",\"%2s");
list ($start, $end, $country) = $array;
print_r($array);
}
?>
/******************************/
Output:
Array
(
[0] => 33996344
[1] => 33996351
[2] => GB
)
....
/****************/
Expected output:
Array
(
[0] => 0033996344
[1] => 0033996351
[2] => GB
)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php