Home > Backend Development > PHP Tutorial > PHP generates csv to display complete Arabic numerals (example)

PHP generates csv to display complete Arabic numerals (example)

WBOY
Release: 2016-07-25 08:52:21
Original
1333 people have browsed it
  1. $arr = array (
  2. array ('111', 2222, '0555'),
  3. array ('222', 3333, '0666')
  4. );
  5. $fp = fopen ('t.csv', 'w');
  6. foreach ($arr as $row) {
  7. fputcsv($fp, array_map('h', $row));
  8. }
  9. fclose($fp);
  10. function h($v) {
  11. if (($v{0} == '0') && is_numeric($v)) {
  12. $v = '="' . $v . '"'; //First First way
  13. //$v = "t{$v}"; //Second way
  14. }
  15. return $v;
  16. }
Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template