PHP 8.5.0 Alpha 1 available for testing

Voting

: one minus zero?
(Example: nine)

The Note You're Voting On

matasbi at gmail dot com
14 years ago
Parse from Microsoft Excel "Unicode Text (*.txt)" format:

<?php
function parse($file) {
if ((
$handle = fopen($file, "r")) === FALSE) return;
while ((
$cols = fgetcsv($handle, 1000, "\t")) !== FALSE) {
foreach(
$cols as $key => $val ) {
$cols[$key] = trim( $cols[$key] );
$cols[$key] = iconv('UCS-2', 'UTF-8', $cols[$key]."\0") ;
$cols[$key] = str_replace('""', '"', $cols[$key]);
$cols[$key] = preg_replace("/^\"(.*)\"$/sim", "$1", $cols[$key]);
}
echo
print_r($cols, 1);
}
}
?>

<< Back to user notes page

To Top