在PHP中返回带有mysql查询的字符串列表

I'm trying to make a simple query with PHP that returns a list of Strings with all the names of the users, but I can figure out how to do do it. The only thing i thought wa this:

<?php

$host_name  = "hostname";
$database   = "database";
$user_name  = "username";
$password   = "pass";

$connect = mysqli_connect($host_name, $user_name, $password, $database);

$select = "SELECT username from userstasker";

$result = $connect->query($select);
$rows = array();

while($r = mysqli_fetch_assoc($result)) {
    $rows[] = $r;
}

echo json_encode($rows);

$connect->close();
?>

But this returns a JSon, ant idea how to do it?

<?php

$host_name  = "hostname";
$database   = "database";
$user_name  = "username";
$password   = "pass";

$connect = mysqli_connect($host_name, $user_name, $password, $database);

$select = "SELECT username from userstasker";

$result = $connect->query($select);
$usernames = array();

while($r = mysqli_fetch_assoc($result)) {
    $usernames[] = $r["username"];
}

$connect->close();

// Do something with $usernames

?>