I'm working on a project where I use php to grab a random greek word from a xampp sql server . I then use str_shuffle() to randomize the word order (ex. bye => ybe).However using str_shuffle() on greek letters returns the word with many ???? in place of most greek letters . If I remove str_shuffle() from my code the greek word is displayed correctly with no ??? .
I have written code that ensures I have the correct encoding but str_shuffle() is the problem .
<h1 id = "hidden-word">The word is :
                <?php 
                    
                    $link = mysqli_connect('localhost' , 'root' , '' ,'dodecanese');
                    if(!$link){
                        echo 'Error connecting to DB';
                        exit;
                    }
                    mysqli_query($link,"SET NAMES 'utf8'");
                    $query = "SELECT island_name FROM dodecanese ORDER BY RAND() LIMIT 1";
                    $result = mysqli_query($link, $query);
                    if(!$result){
                        echo 'There is an issue with the DB';
                        exit;
                    }
                    $row = mysqli_fetch_assoc($result); 
                    //str shuffle creates ?
                    echo '<span id = "random-island">'.str_shuffle($row['island_name']). '</span>';
                ?>
        
</h1> I also have encoding     <meta charset="utf-8"/> on html . I have seen many posts about this and especially the UTF-8 all the way through but it did not help . I would appreciate your help with this . Thank you in advance .
 
     
     
     
    