public function join(array $array, string $separator = ','): string
    {
        $result = '';

        foreach ($array as $item) {
            if (is_array($item)) {
                $result .= $this->join($item, $separator) . $separator;
            } else {
                $result .= $item . $separator;
            }
        }

        $result = substr($result, 0, 0 - strlen($separator));

        return $result;
    }
public function join(array $array, string $separator = ','): string
    {
        $result = '';

        foreach ($array as $item) {
            if (is_array($item)) {
                $result .= $this->join($item, $separator) . $separator;
            } else {
                $result .= $item . $separator;
            }
        }

        $result = substr($result, 0, 0 - strlen($separator));

        return $result;
    }
public function join ( array $ array , string $ separator = ',' ) : string { $ result = '' ; foreach ( $ array as $ item ) { if ( is_array ( $ item ) ) { $ result .= $ this -> join ( $ item , $ separator ) . $ separator ; } else { $ result .= $ item . $ separator ; } } $ result = substr ( $ result , 0 , 0 - strlen ( $ separator ) ) ; return $ result ; }
Join the given array recursively
using the given separator string.

@param array  $array     The array
@param string $separator The speparator, defaults to ','

@return string The joined string
Join the given array recursively using the given separator string .