Created
November 26, 2021 14:14
-
-
Save mertbuldur/c04b6cb928b8eaa1de8994bd81d7c50b to your computer and use it in GitHub Desktop.
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
function humanJoin($array , $glue = ', ',$finalGlue = ' ve '){ | |
$arr = [implode($glue,array_slice($array,0,-1)),...array_slice($array,-1)]; | |
$arr = array_filter($arr,function($e){ | |
return $e != ''; | |
}); | |
return implode($finalGlue,$arr); | |
} | |
echo humanJoin(['Ali','Veli','Mehmet']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment