Created
September 19, 2019 12:16
-
-
Save oppara/afaca3bf099d8b0c704e700fe27e29fa to your computer and use it in GitHub Desktop.
CSVデータ作成
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makeCsv(array $record) | |
{ | |
$tmp = []; | |
foreach ($record as $val) { | |
if (preg_match('/[,\r\n"]/', $val)) { | |
$val = str_replace('"', '""', $val); | |
$tmp[] = '"' . $val . '"'; | |
continue; | |
} | |
$tmp[] = $val; | |
} | |
return implode(',', $tmp); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
静彌とか