Last active
September 4, 2017 15:19
-
-
Save hlindberg/1a07aa1a859d5b5cd713effa3faa0977 to your computer and use it in GitHub Desktop.
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 myjoin(Array $a, String $delimiter) { | |
$formats = { | |
Array => { | |
# no delimiters = '% ', and 'a' means array | |
format => '% a', | |
separator => $delimiter, | |
# format strings without delimiters = '%s' | |
string_formats => { String => '%s' } | |
} | |
} | |
String($a, $formats) | |
} | |
$test = ['the', 'quick', 'brown', 'fox'] | |
notice myjoin($test, "::") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
outputs
the::quick::brown::fox