已解决的数组特殊字符到字符串

I am creating password generator, I am dealing at the moment with array of special characters to transfer them into string. I have special characters saved in cvs file, using as array to slice based on how many special characters should be in password, then I want to make them string and concatenate with numbers and letters.

    $list = './SpecialChar.csv';
    $e = array_map('str_getcsv', file($list));

    //$nRange telling how many characters should be slice
    $nRange = $length-($numb*2)-$specialChar;

    shuffle($e);
    $s = array_slice($e,0,$nRange);
    $sString = implode(" ",$s); //does not work
    $sString = htmlentities(implode(" ",$s)); //does not work

implode only accepts string so if you try to convert array to string this will return you "string(5) "Array"" no matter what it's in the array

var_dump((string)["T","E","S","T"]);

So when you try to implode multidimensional array you will get something like this

    $test = [["-"], ["*"]];
var_dump(implode(" ", $test)); //THIS WILL GIVE YOU Notice: Array to string conversion when using implode , but it will return string(11) "Array Array"

If dimensional are only two you can use array_map

$test = [["-"], ["*"]];
var_dump(implode(" ", array_map(function ($row) {
                        return is_array($row)?implode($row):$row;
                    }, $test))); //returns string(3) "- *"