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

PHP generates csv to display complete Arabic numerals (example)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-25 08:52:211458browse
  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


Statement:
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