src/Headzoo/Core/Arrays.php
public static function join(array $array, $separator = self::DEFAULT_SEPARATOR, callable $callback = null)
    {
        self::swapCallable($separator, $callback, self::DEFAULT_SEPARATOR);
        if (null !== $callback) {
            $array = array_map($callback, $array);
        }
        
        return join($separator, $array);
    }
public static function join(array $array, $separator = self::DEFAULT_SEPARATOR, callable $callback = null)
    {
        self::swapCallable($separator, $callback, self::DEFAULT_SEPARATOR);
        if (null !== $callback) {
            $array = array_map($callback, $array);
        }
        
        return join($separator, $array);
    }
public static function join ( array $ array , $ separator = self :: DEFAULT_SEPARATOR , callable $ callback = null ) { self :: swapCallable ( $ separator , $ callback , self :: DEFAULT_SEPARATOR ) ; if ( null !== $ callback ) { $ array = array_map ( $ callback , $ array ) ; } return join ( $ separator , $ array ) ; }
Joins the elements of an array using an optional callback

Works exactly the same as php's join() method, however each element of
the array will be passed to the callback function. The callback return
value is what gets joined.

Example:
```php
$array = [
"headzoo",
"joe",
"sam"
];

echo Arrays::join($array);
// Outputs: headzoo, joe, sam

echo Arrays::join($array, " - ");
// Outputs: headzoo - joe - sam

echo Arrays::join($array, ", ", 'Headzoo\Core\Strings::quote');
// Outputs: 'headzoo', 'joe', 'sam'

// The default separator will be used when the middle argument is omitted, and the
// last argument is callable object.
echo Arrays::join($array, 'Headzoo\Core\Strings::quote');
```

@param  array    $array     The array to join
@param  string   $separator The separator string
@param  callable $callback  Callback applied to each element of the array
@return string
Joins the elements of an array using an optional callback