Created
July 7, 2014 19:01
-
-
Save mschultheiss83/f18e82f688d0bcfcbe98 to your computer and use it in GitHub Desktop.
test file
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
<?php | |
/** | |
* @author mschultheiss83 | |
* https://github.com/mschultheiss83 | |
*/ | |
/** | |
* @param array $arrData | |
* @param bool $bIncludeHeader | |
* @return string | |
*/ | |
function array_2_csv($arrData = array(), $bIncludeHeader = false ) { | |
$csv = array(); | |
if ($bIncludeHeader) { | |
$csv[] = array_2_csv(array_keys($arrData)); | |
} | |
foreach ($arrData as $item) { | |
if (is_array($item)) { | |
$csv[] = array_2_csv($item); | |
} else { | |
$csv[] = $item; | |
} | |
} | |
return implode(';', $csv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment