Created
June 15, 2016 13:47
-
-
Save softon/383e4685492abcc305c3dadce95bf03a to your computer and use it in GitHub Desktop.
Converts an Array to comma seperated string
This file contains 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 | |
function arrayToCommaSeperatedString($arr,$key=null){ | |
$str = ''; | |
if(is_null($key)) | |
return $str; | |
foreach($arr as $arr_ele){ | |
$str .= $$arr_ele[$key].", "; | |
} | |
return rtrim($str_authors,', '); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment